@Override public boolean configure(FeatureContext configuration) { if (cache == null) cache = new LightweightBrowserCache(); configuration.property(BrowserCache.class.getName(), cache); configuration.register(new CacheInterceptor(cache)); return true; } }
public Entry put(String key, MediaType mediaType, MultivaluedMap<String, String> headers, byte[] cached, int expires, String etag, String lastModified) { Entry previousValue = internalCache.get(key, mediaType); int sizeDiff = -1; if (previousValue == null) sizeDiff = cached.length; else sizeDiff = cached.length - previousValue.getCached().length; if (bytes.addAndGet(sizeDiff) > maxBytes) { clear(); bytes.addAndGet(sizeDiff); } return internalCache.put(key, mediaType, headers, cached, expires, etag, lastModified); }
@Override public boolean configure(FeatureContext configuration) { if (cache == null) cache = new LightweightBrowserCache(); configuration.property(BrowserCache.class.getName(), cache); configuration.register(new CacheInterceptor(cache)); return true; } }
public Entry put(String key, MediaType mediaType, MultivaluedMap<String, String> headers, byte[] cached, int expires, String etag, String lastModified) { Entry previousValue = internalCache.get(key, mediaType); int sizeDiff = -1; if (previousValue == null) sizeDiff = cached.length; else sizeDiff = cached.length - previousValue.getCached().length; if (bytes.addAndGet(sizeDiff) > maxBytes) { clear(); bytes.addAndGet(sizeDiff); } return internalCache.put(key, mediaType, headers, cached, expires, etag, lastModified); }
@Override public boolean configure(FeatureContext configuration) { if (cache == null) cache = new LightweightBrowserCache(); configuration.property(BrowserCache.class.getName(), cache); configuration.register(new CacheInterceptor(cache)); return true; } }
public Entry put(String key, MediaType mediaType, MultivaluedMap<String, String> headers, byte[] cached, int expires, String etag, String lastModified) { Entry previousValue = internalCache.get(key, mediaType); int sizeDiff = -1; if (previousValue == null) sizeDiff = cached.length; else sizeDiff = cached.length - previousValue.getCached().length; if (bytes.addAndGet(sizeDiff) > maxBytes) { clear(); bytes.addAndGet(sizeDiff); } return internalCache.put(key, mediaType, headers, cached, expires, etag, lastModified); }