/** * Makes the client proxy cacheable. Returns the cache that will hold * returned values from the server. * * @param clientProxy * @return */ public static LightweightBrowserCache makeCacheable(Object clientProxy) { LightweightBrowserCache cache = new LightweightBrowserCache(); makeCacheable(clientProxy, cache); return cache; }
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); }
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); }
/** * Makes the client proxy cacheable. Returns the cache that will hold * returned values from the server. * * @param clientProxy * @return */ public static LightweightBrowserCache makeCacheable(Object clientProxy) { LightweightBrowserCache cache = new LightweightBrowserCache(); makeCacheable(clientProxy, cache); return cache; }