org.jboss.resteasy.client.cache
Class LightweightBrowserCache
java.lang.Object
org.jboss.resteasy.client.cache.LightweightBrowserCache
- All Implemented Interfaces:
- BrowserCache
public class LightweightBrowserCache
- extends java.lang.Object
- implements BrowserCache
In-memory BrowserCache. Uses an underlying cache, with ConcurrentMapCache as
the default. You specify maximum bytes you want the cache to have. The
default is 2Megabytes. If the cache exceeds this amount, it is wiped clean.
This rather draconian approach to cache reaping is to avoid synchronization
that you would normally have to do in a sophisticated cache.
With high concurrent access, because this is not a sophisticated cache,
sometimes a cache entry may be lost. It is consistent though.
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
maxBytes
protected long maxBytes
internalCache
protected BrowserCache internalCache
bytes
protected java.util.concurrent.atomic.AtomicLong bytes
LightweightBrowserCache
public LightweightBrowserCache()
LightweightBrowserCache
public LightweightBrowserCache(BrowserCache cache)
getInternalCache
public BrowserCache getInternalCache()
setInternalCache
public void setInternalCache(BrowserCache internalCache)
getMaxBytes
public long getMaxBytes()
setMaxBytes
public void setMaxBytes(long maxBytes)
getAny
public BrowserCache.Entry getAny(java.lang.String key)
- Specified by:
getAny
in interface BrowserCache
remove
public BrowserCache.Entry remove(java.lang.String key,
MediaType type)
- Specified by:
remove
in interface BrowserCache
getByteCount
public long getByteCount()
get
public BrowserCache.Entry get(java.lang.String key,
MediaType accept)
- Specified by:
get
in interface BrowserCache
put
public BrowserCache.Entry put(java.lang.String key,
MediaType mediaType,
MultivaluedMap<java.lang.String,java.lang.String> headers,
byte[] cached,
int expires,
java.lang.String etag,
java.lang.String lastModified)
- Specified by:
put
in interface BrowserCache
clear
public void clear()
- Specified by:
clear
in interface BrowserCache
Copyright © 2010. All Rights Reserved.