public void removeCache(String url) { Log.v("마이볼리 캐쉬 사이즈", String.valueOf(cache.size())); Log.v("마이볼리 캐쉬", String.valueOf(cache)); Log.v("url name", url); if (cache.remove(url) == null) { Log.v("url", "null"); } Log.v("마이볼리 캐쉬 사이즈", String.valueOf(cache.size())); Log.v("마이볼리 캐쉬", String.valueOf(cache)); }
/** * Add or replace placeholder for a new image that does not exist yet. * * @param uri the uri of the placeholder to replace, or null if this is a new one * @param placeholder the placeholder image * @return A URI used to reference this placeholder */ public static void replacePlaceholder(Uri uri, Bitmap placeholder) { Log.v(TAG, "session bitmap cache size: " + sSessionsToPlaceholderBitmap.size()); Point size = new Point(placeholder.getWidth(), placeholder.getHeight()); sSessionsToSizes.put(uri, size); sSessionsToPlaceholderBitmap.put(uri, placeholder); Integer currentVersion = sSessionsToPlaceholderVersions.get(uri); sSessionsToPlaceholderVersions.put(uri, currentVersion == null ? 0 : currentVersion + 1); }
public void clearCache() { Log.v("마이볼리 캐쉬 사이즈", String.valueOf(cache.size())); Log.v("마이볼리 캐쉬", String.valueOf(cache)); /* ClearCacheRequest ccr = new ClearCacheRequest(requestQueue.getCache(), new Runnable() { @Override public void run() { } }); ccr.setTag(this); Log.v("캐쉬","클리어"); requestQueue.add(ccr);*/ cache.evictAll(); Log.v("캐쉬", "클리어"); Log.v("마이볼리 캐쉬 사이즈", String.valueOf(cache.size())); Log.v("마이볼리 캐쉬", String.valueOf(cache)); }
@Test public void shouldLru() throws Exception { LruCache<Integer, String> lruCache = new LruCache<Integer, String>(2); lruCache.put(1, "one"); lruCache.put(2, "two"); lruCache.put(3, "three"); assertThat(lruCache.size()).isEqualTo(2); assertThat(lruCache.get(1)).isNull(); assertThat(lruCache.get(2)).isEqualTo("two"); assertThat(lruCache.get(3)).isEqualTo("three"); }
/** Get the total size of the cache in KB. */ public int getCacheSize() { return mMemoryCache.size(); }
public int size() { return mLruCache.size(); }
@Override public int size() { return mCache.size(); }