public synchronized Stock getStock(StockInfo info, boolean force) { if (info == null) { Log.v(TAG, "getStock - info is null"); return null; } Log.v(TAG, "getStock - stock_id:" + info.stock_id + ", force:" + force); // 先内存 Stock stock = cache.get(info.getKey()); // 再sql if (stock == null) { stock = new Stock(info); cache.put(info.getKey(), stock); } // 最后网络 if (stock.outOfDate()) { cache.remove(info.getKey()); stock.updateSQL(force); // sync NET and persit to SQL stock = new Stock(info); // reload from SQL cache.put(info.getKey(), stock); } return stock; }
public void remove(K key) { RefCountedMemory mem = map.remove(key); if (mem != null) mem.unreference(); }
public void remove(K key) { map.remove(key); }