/** * Insert into the right place in a sorted MapElement array. */ private final CacheEntry removeCache(String name) { CacheEntry[] oldCache = cache; int pos = find(oldCache, name); if ((pos != -1) && (name.equals(oldCache[pos].name))) { CacheEntry[] newCache = new CacheEntry[cache.length - 1]; System.arraycopy(oldCache, 0, newCache, 0, pos); System.arraycopy(oldCache, pos + 1, newCache, pos, oldCache.length - pos - 1); cache = newCache; return oldCache[pos]; } return null; }
public void load(CacheEntry entry) { if (entry.exists) { if (insertCache(entry)) { cacheSize += entry.size; } } else { int sizeIncrement = (notFoundCache.get(entry.name) == null) ? 1 : 0; notFoundCache.put(entry.name, entry); cacheSize += sizeIncrement; } }
public boolean unload(String name) { CacheEntry removedEntry = removeCache(name); if (removedEntry != null) { cacheSize -= removedEntry.size; return true; } else if (notFoundCache.remove(name) != null) { cacheSize--; return true; } return false; }
/** * Remove entry from cache. */ protected boolean cacheUnload(String name) { if (cache == null) return false; synchronized (cache) { return cache.unload(name); } }
CacheEntry cacheEntry = cache.lookup(name); if (cacheEntry == null) { cacheEntry = new CacheEntry();
cache.setCacheMaxSize(baseDirContext.getCacheMaxSize()); cacheTTL = baseDirContext.getCacheTTL(); cacheObjectMaxSize = baseDirContext.getCacheObjectMaxSize();
cache = new ResourceCache(); cache.setCacheMaxSize(baseDirContext.getCacheMaxSize()); cache.setSpareNotFoundEntries(baseDirContext.getCacheMaxSize()/8); cacheTTL = baseDirContext.getCacheTTL(); cacheObjectMaxSize = baseDirContext.getCacheObjectMaxSize();
cache = new ResourceCache(); cache.setCacheMaxSize(baseDirContext.getCacheMaxSize()); cacheTTL = baseDirContext.getCacheTTL(); cacheObjectMaxSize = baseDirContext.getCacheObjectMaxSize();
/** * Remove entry from cache. */ protected boolean cacheUnload(String name) { if (cache == null) return false; synchronized (cache) { return cache.unload(name); } }
CacheEntry cacheEntry = cache.lookup(name); if (cacheEntry == null) { cacheEntry = new CacheEntry();
cache.setCacheMaxSize(baseDirContext.getCacheMaxSize()); cacheTTL = baseDirContext.getCacheTTL(); cacheObjectMaxSize = baseDirContext.getCacheObjectMaxSize();
/** * Insert into the right place in a sorted MapElement array. */ private final CacheEntry removeCache(String name) { CacheEntry[] oldCache = cache; int pos = find(oldCache, name); if ((pos != -1) && (name.equals(oldCache[pos].name))) { CacheEntry[] newCache = new CacheEntry[cache.length - 1]; System.arraycopy(oldCache, 0, newCache, 0, pos); System.arraycopy(oldCache, pos + 1, newCache, pos, oldCache.length - pos - 1); cache = newCache; return oldCache[pos]; } return null; }
/** * Remove entry from cache. */ protected boolean cacheUnload(String name) { if (cache == null) return false; // To ensure correct operation, particularly of WebDAV, unload // the resource with and without a trailing / String name2; if (name.endsWith("/")) { name2 = name.substring(0, name.length() -1); } else { name2 = name + "/"; } synchronized (cache) { boolean result = cache.unload(name); cache.unload(name2); return result; } } }
public void load(CacheEntry entry) { if (entry.exists) { if (insertCache(entry)) { cacheSize += entry.size; } } else { int sizeIncrement = (notFoundCache.get(entry.name) == null) ? 1 : 0; notFoundCache.put(entry.name, entry); cacheSize += sizeIncrement; } }
public boolean unload(String name) { CacheEntry removedEntry = removeCache(name); if (removedEntry != null) { cacheSize -= removedEntry.size; return true; } else if (notFoundCache.remove(name) != null) { cacheSize--; return true; } return false; }
CacheEntry cacheEntry = cache.lookup(name); if (cacheEntry == null) { cacheEntry = new CacheEntry();
cache.setCacheMaxSize(baseDirContext.getCacheMaxSize()); cacheTTL = baseDirContext.getCacheTTL(); cacheObjectMaxSize = baseDirContext.getCacheObjectMaxSize();