@Override public void setCacheTtl(long cacheTtl) { cache.setTtl(cacheTtl); }
@Override public void backgroundProcess() { cache.backgroundProcess(); }
@Override public void setCachingAllowed(boolean cachingAllowed) { this.cachingAllowed = cachingAllowed; if (!cachingAllowed) { cache.clear(); } }
if (noCache(path)) { return root.getResourceInternal(path, useClassLoaderResources); removeCacheEntry(path, true); cacheEntry = null; int objectMaxSizeBytes = getObjectMaxSizeBytes(); CachedResource newCacheEntry = new CachedResource(root, path, getTtl(), objectMaxSizeBytes); long newSize = evict( targetSize, resourceCache.values().iterator()); if (newSize > maxSize) { removeCacheEntry(path, true); log.warn(sm.getString("cache.addFail", path));
@Override public void setCacheObjectMaxSize(int cacheObjectMaxSize) { cache.setObjectMaxSize(cacheObjectMaxSize); // Don't enforce the limit when not running as attributes may get set in // any order. if (getState().isAvailable()) { cache.enforceObjectMaxSizeLimit(); } }
@Override public long getCacheTtl() { return cache.getTtl(); }
private WebResource getResource(String path, boolean validate, boolean useClassLoaderResources) { if (validate) { path = validate(path); } if (isCachingAllowed()) { return cache.getResource(path, useClassLoaderResources); } else { return getResourceInternal(path, useClassLoaderResources); } }
@Override public int getCacheObjectMaxSize() { return cache.getObjectMaxSize(); }
@Override public long getCacheMaxSize() { return cache.getMaxSize(); }
protected void backgroundProcess() { // Create an ordered set of all cached resources with the least recently // used first. This is a background process so we can afford to take the // time to order the elements first TreeSet<CachedResource> orderedResources = new TreeSet<>(new EvictionOrder()); orderedResources.addAll(resourceCache.values()); Iterator<CachedResource> iter = orderedResources.iterator(); long targetSize = maxSize * (100 - TARGET_FREE_PERCENT_BACKGROUND) / 100; long newSize = evict(targetSize, iter); if (newSize > targetSize) { log.info(sm.getString("cache.backgroundEvictFail", Long.valueOf(TARGET_FREE_PERCENT_BACKGROUND), root.getContext().getName(), Long.valueOf(newSize / 1024))); } }
removeCacheEntry(path); cacheEntry = null; int objectMaxSizeBytes = getObjectMaxSizeBytes(); CachedResource newCacheEntry = new CachedResource(this, root, path, getTtl(), objectMaxSizeBytes, useClassLoaderResources); long newSize = evict(targetSize, resourceCache.values().iterator()); if (newSize > maxSize) { removeCacheEntry(path); log.warn(sm.getString("cache.addFail", path));
@Override public void setCacheObjectMaxSize(int cacheObjectMaxSize) { cache.setObjectMaxSize(cacheObjectMaxSize); // Don't enforce the limit when not running as attributes may get set in // any order. if (getState().isAvailable()) { cache.enforceObjectMaxSizeLimit(); } }
@Override public long getCacheTtl() { return cache.getTtl(); }
private WebResource getResource(String path, boolean validate, boolean useClassLoaderResources) { if (validate) { path = validate(path); } if (isCachingAllowed()) { return cache.getResource(path, useClassLoaderResources); } else { return getResourceInternal(path, useClassLoaderResources); } }
@Override public int getCacheObjectMaxSize() { return cache.getObjectMaxSize(); }
@Override public long getCacheMaxSize() { return cache.getMaxSize(); }
protected void backgroundProcess() { // Create an ordered set of all cached resources with the least recently // used first. This is a background process so we can afford to take the // time to order the elements first TreeSet<CachedResource> orderedResources = new TreeSet<>(new EvictionOrder()); orderedResources.addAll(resourceCache.values()); Iterator<CachedResource> iter = orderedResources.iterator(); long targetSize = maxSize * (100 - TARGET_FREE_PERCENT_BACKGROUND) / 100; long newSize = evict(targetSize, iter); if (newSize > targetSize) { log.info(sm.getString("cache.backgroundEvictFail", Long.valueOf(TARGET_FREE_PERCENT_BACKGROUND), root.getContext().getName(), Long.valueOf(newSize / 1024))); } }
@Override protected void startInternal() throws LifecycleException { mainResources.clear(); main = createMainResourceSet(); mainResources.add(main); for (List<WebResourceSet> list : allResources) { // Skip class resources since they are started below if (list != classResources) { for (WebResourceSet webResourceSet : list) { webResourceSet.start(); } } } // This has to be called after the other resources have been started // else it won't find all the matching resources processWebInfLib(); // Need to start the newly found resources for (WebResourceSet classResource : classResources) { classResource.start(); } cache.enforceObjectMaxSizeLimit(); setState(LifecycleState.STARTING); }
removeCacheEntry(path); cacheEntry = null; int objectMaxSizeBytes = getObjectMaxSizeBytes(); CachedResource newCacheEntry = new CachedResource(this, root, path, getTtl(), objectMaxSizeBytes, useClassLoaderResources); long newSize = evict(targetSize, resourceCache.values().iterator()); if (newSize > maxSize) { removeCacheEntry(path); log.warn(sm.getString("cache.addFail", path));