Picasso p = new Picasso.Builder(context) .memoryCache(new LruCache(24000)) .build();
/** * item value has been removed from the cache * @param item <code>CacheItem</code> that was just removed * * Cache bucket is already synchronized by the caller */ protected void itemRemoved(CacheItem item) { super.itemRemoved(item); // update the size decrementCurrentSize(item.getSize()); }
/** * remove the item stored at the key. * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(Object key) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * item value has been refreshed * @param item <code>CacheItem</code> that was refreshed * @param oldSize size of the previous value that was refreshed * Cache bucket is already synchronized by the caller */ protected void itemRefreshed(CacheItem item, int oldSize) { super.itemRefreshed(item, oldSize); /** reduce the cache by the size of the size of the previous value * and increment by the value being refreshed with. */ decrementCurrentSize(oldSize); incrementCurrentSize(item.getSize()); }
/** * remove the item stored at the key. * @param hashCode a precomputed hashCode * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(int hashCode, Object key) { Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * Returns current number of buckets */ public Integer getTableSize() { return (Integer) baseCache.getStatByName( Constants.STAT_BASECACHE_TABLE_SIZE); }
/** * has cache reached its threshold * @return true when the cache reached its threshold */ protected boolean isThresholdReached() { return (currentSize > maxSize || super.isThresholdReached()); }
/** * Returns the current size of the cache in bytes */ public Long getCurrentSize() { return (Long) boundedMultiLruCache.getStatByName( Constants.STAT_BOUNDEDMULTILRUCACHE_CURRENT_SIZE); }
/** * item value has been refreshed * @param item <code>CacheItem</code> that was refreshed * @param oldSize size of the previous value that was refreshed * Cache bucket is already synchronized by the caller */ protected void itemRefreshed(CacheItem item, int oldSize) { itemAccessed(item); }
/** * item value has been refreshed * @param item <code>CacheItem</code> that was refreshed * @param oldSize size of the previous value that was refreshed * Cache bucket is already synchronized by the caller */ protected void itemRefreshed(CacheItem item, int oldSize) { super.itemRefreshed(item, oldSize); /** reduce the cache by the size of the size of the previous value * and increment by the value being refreshed with. */ decrementCurrentSize(oldSize); incrementCurrentSize(item.getSize()); }
/** * item value has been removed from the cache * @param item <code>CacheItem</code> that was just removed * * Cache bucket is already synchronized by the caller */ protected void itemRemoved(CacheItem item) { super.itemRemoved(item); // update the size decrementCurrentSize(item.getSize()); }
/** * remove the item stored at the key. * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(Object key) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the item stored at the key. * @param hashCode a precomputed hashCode * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(int hashCode, Object key) { Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * Returns maximum possible number of entries */ public Integer getMaxEntries() { return (Integer) baseCache.getStatByName( Constants.STAT_BASECACHE_MAX_ENTRIES); }
/** * item value has been refreshed * @param item <code>CacheItem</code> that was refreshed * @param oldSize size of the previous value that was refreshed * Cache bucket is already synchronized by the caller */ protected void itemRefreshed(CacheItem item, int oldSize) { super.itemRefreshed(item, oldSize); /** reduce the cache by the size of the size of the previous value * and increment by the value being refreshed with. */ decrementCurrentSize(oldSize); incrementCurrentSize(item.getSize()); }
/** * item value has been removed from the cache * @param item <code>CacheItem</code> that was just removed * * Cache bucket is already synchronized by the caller */ protected void itemRemoved(CacheItem item) { super.itemRemoved(item); // update the size decrementCurrentSize(item.getSize()); }
/** * remove the item stored at the key. * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(Object key) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the item stored at the key. * @param hashCode a precomputed hashCode * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(int hashCode, Object key) { Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * Returns the number of times new entries have been added */ public Integer getAddCount() { return (Integer) baseCache.getStatByName( Constants.STAT_BASECACHE_ADD_COUNT); } }
/** * item value has been removed from the cache * @param item <code>CacheItem</code> that was just removed * * Cache bucket is already synchronized by the caller */ protected void itemRemoved(CacheItem item) { super.itemRemoved(item); // update the size decrementCurrentSize(item.getSize()); }