public abstract class AbstractSerializingCacheStorage<T,CAS> extends Object implements HttpCacheStorage
Constructor and Description |
---|
AbstractSerializingCacheStorage(int maxUpdateRetries,
HttpCacheEntrySerializer<T> serializer) |
Modifier and Type | Method and Description |
---|---|
protected abstract Map<String,T> |
bulkRestore(Collection<String> storageKeys) |
protected abstract void |
delete(String storageKey) |
protected abstract String |
digestToStorageKey(String key) |
Map<String,HttpCacheEntry> |
getEntries(Collection<String> keys)
Retrieves multiple cache entries stored under the given keys.
|
HttpCacheEntry |
getEntry(String key)
Retrieves the cache entry stored under the given key
or null if no entry exists under that key.
|
protected abstract CAS |
getForUpdateCAS(String storageKey) |
protected abstract T |
getStorageObject(CAS cas) |
void |
putEntry(String key,
HttpCacheEntry entry)
Store a given cache entry under the given key.
|
void |
removeEntry(String key)
Deletes/invalidates/removes any cache entries currently
stored under the given key.
|
protected abstract T |
restore(String storageKey) |
protected abstract void |
store(String storageKey,
T storageObject) |
protected abstract boolean |
updateCAS(String storageKey,
CAS cas,
T storageObject) |
void |
updateEntry(String key,
HttpCacheCASOperation casOperation)
Atomically applies the given callback to processChallenge an existing cache
entry under a given key.
|
public AbstractSerializingCacheStorage(int maxUpdateRetries, HttpCacheEntrySerializer<T> serializer)
protected abstract void store(String storageKey, T storageObject) throws ResourceIOException
ResourceIOException
protected abstract T restore(String storageKey) throws ResourceIOException
ResourceIOException
protected abstract CAS getForUpdateCAS(String storageKey) throws ResourceIOException
ResourceIOException
protected abstract T getStorageObject(CAS cas) throws ResourceIOException
ResourceIOException
protected abstract boolean updateCAS(String storageKey, CAS cas, T storageObject) throws ResourceIOException
ResourceIOException
protected abstract void delete(String storageKey) throws ResourceIOException
ResourceIOException
protected abstract Map<String,T> bulkRestore(Collection<String> storageKeys) throws ResourceIOException
ResourceIOException
public final void putEntry(String key, HttpCacheEntry entry) throws ResourceIOException
HttpCacheStorage
putEntry
in interface HttpCacheStorage
key
- where in the cache to store the entryentry
- cached response to storeResourceIOException
public final HttpCacheEntry getEntry(String key) throws ResourceIOException
HttpCacheStorage
getEntry
in interface HttpCacheStorage
key
- cache keyHttpCacheEntry
or null
if no
entry existsResourceIOException
public final void removeEntry(String key) throws ResourceIOException
HttpCacheStorage
removeEntry
in interface HttpCacheStorage
ResourceIOException
public final void updateEntry(String key, HttpCacheCASOperation casOperation) throws HttpCacheUpdateException, ResourceIOException
HttpCacheStorage
updateEntry
in interface HttpCacheStorage
key
- indicates which entry to modifycasOperation
- the CAS operation to perform.HttpCacheUpdateException
ResourceIOException
public final Map<String,HttpCacheEntry> getEntries(Collection<String> keys) throws ResourceIOException
HttpCacheStorage
getEntries
in interface HttpCacheStorage
keys
- cache keysHttpCacheEntry
s.ResourceIOException
Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.