Interface HttpCacheStore
-
public interface HttpCacheStoreData store for persisting cache items. Data store implementation could be in-memory, disk or even JCR repository. Multiple implementation of this cache store can be present at any time and they can work in conjunction.
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_CACHE_STORE_TYPERepresents the key to find out the type of cache data store.static StringPN_MAXSIZEstatic StringPN_TTLstatic StringVALUE_CAFFEINE_MEMORY_STORE_TYPEValue representing EHCache type of cache store for the keyKEY_CACHE_STORE_TYPEstatic StringVALUE_DISK_CACHE_STORE_TYPEValue representing disk type of cache store for the keyKEY_CACHE_STORE_TYPEstatic StringVALUE_JCR_CACHE_STORE_TYPEValue representing JCR type of cache store for the keyKEY_CACHE_STORE_TYPEstatic StringVALUE_MEM_CACHE_STORE_TYPEValue representing in-memory type of cache store for the keyKEY_CACHE_STORE_TYPE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontains(CacheKey key)Check if there is an entry in cache for the given key.TempSinkcreateTempSink()Create a temp sink for stashing response stream.CacheContentgetIfPresent(CacheKey key)Get the Cache item given a key.StringgetStoreType()Returns the store type of this store.voidinvalidate(HttpCacheConfig cacheConfig)Invalidate all the cached items applicable for the given cache config.voidinvalidate(CacheKey key)Invalidate the given cache key.voidinvalidateAll()Invalidate all entries in the cache.voidput(CacheKey key, CacheContent content)Put an item into the cache.longsize()Get the number of entries in the cache.
-
-
-
Field Detail
-
KEY_CACHE_STORE_TYPE
static final String KEY_CACHE_STORE_TYPE
Represents the key to find out the type of cache data store. Type could be MEM, DISK, JCR, etc.- See Also:
- Constant Field Values
-
VALUE_MEM_CACHE_STORE_TYPE
static final String VALUE_MEM_CACHE_STORE_TYPE
Value representing in-memory type of cache store for the keyKEY_CACHE_STORE_TYPE- See Also:
- Constant Field Values
-
VALUE_DISK_CACHE_STORE_TYPE
static final String VALUE_DISK_CACHE_STORE_TYPE
Value representing disk type of cache store for the keyKEY_CACHE_STORE_TYPE- See Also:
- Constant Field Values
-
VALUE_JCR_CACHE_STORE_TYPE
static final String VALUE_JCR_CACHE_STORE_TYPE
Value representing JCR type of cache store for the keyKEY_CACHE_STORE_TYPE- See Also:
- Constant Field Values
-
VALUE_CAFFEINE_MEMORY_STORE_TYPE
static final String VALUE_CAFFEINE_MEMORY_STORE_TYPE
Value representing EHCache type of cache store for the keyKEY_CACHE_STORE_TYPE- See Also:
- Constant Field Values
-
PN_TTL
static final String PN_TTL
- See Also:
- Constant Field Values
-
PN_MAXSIZE
static final String PN_MAXSIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
put
void put(CacheKey key, CacheContent content) throws HttpCacheDataStreamException
Put an item into the cache.- Parameters:
key- Object holding the key attributes.content- Object holding the content which needs to be cached.- Throws:
HttpCacheDataStreamException- Failure when reading the input stream.
-
contains
boolean contains(CacheKey key)
Check if there is an entry in cache for the given key.- Parameters:
key-- Returns:
-
getIfPresent
CacheContent getIfPresent(CacheKey key)
Get the Cache item given a key.- Parameters:
key- bject holding the key attributes.- Returns:
- Object holding the content which needs to be cached. Null if key not present.
-
size
long size()
Get the number of entries in the cache.- Returns:
-
invalidate
void invalidate(CacheKey key)
Invalidate the given cache key.- Parameters:
key-
-
invalidate
void invalidate(HttpCacheConfig cacheConfig)
Invalidate all the cached items applicable for the given cache config.- Parameters:
cacheConfig-
-
invalidateAll
void invalidateAll()
Invalidate all entries in the cache.
-
createTempSink
TempSink createTempSink()
Create a temp sink for stashing response stream.- Returns:
-
getStoreType
String getStoreType()
Returns the store type of this store.- Returns:
-
-