public static void clearAll() { caches.clear(); }
public static synchronized EwCache<Object, Object> getCache(String name, int count) { if (!cache) return null; SoftReference<EwCache<Object, Object>> cache = caches.get(name); EwCache<Object, Object> cacheActual; if (cache != null) if ((cacheActual = cache.get()) != null) return cacheActual; System.out.println("Creating cache: " + name); caches.put(name, new SoftReference<EwCache<Object, Object>>(cacheActual = new EwCache<Object, Object>(count))); return cacheActual; }
public static synchronized EwCache<Object, Object> getCache(String name) { return getCache(name, 2000); }
Object lock = null; if (optAsBoolean("removeAllGlobal", false, c, parameters, dataStreams)) { EwCache.caches.clear(); obj.clear(); return null; if (optAsBoolean("remove", false, c, parameters, dataStreams)) { if (global) { EwCache.getCache("GlobalCache").remove(cacheName); } else { c.remove(cacheName); result = EwCache.getCache("GlobalCache").get(cacheName); } else { result = c.get(cacheName); if (!optAsBoolean("justLock", false, c, parameters, dataStreams)) { if (global) { EwCache.getCache("GlobalCache").put(cacheName, result); } else { c.put(cacheName, result);
@Override public Object resolve(Context c, Map<String, String[]> parameters, Map<String, InputStream> dataStreams) throws JSONException { EwCache<Object,Object> cache = EwCache.getCache("CruncherCache", 5000); String threadId = parameters.get("threadId")[0]; String name = getAsString("obj", c, parameters, dataStreams); return cache.get(threadId+name); }
public synchronized void put(K key, V value) { if (cache) if (value == null) remove(key); else map.put(key, value); }
EwCache.clearAll();