java.lang.Object | |
↳ | org.apache.http.impl.client.cache.ehcache.EhcacheHttpCacheStorage |
This class is a storage backend for cache entries that uses the popular Ehcache cache implementation. In particular, this backend allows for spillover to disk, where the cache can be effectively larger than memory, and cached responses are paged into and out of memory from disk as needed.
N.B. Since the Ehcache is configured ahead of time with a
maximum number of cache entries, this effectively ignores the
maximum cache entries
specified by a provided CacheConfig
.
Please refer to the Ehcache documentation for details on how to configure the Ehcache itself.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a storage backend using the provided Ehcache
with default configuration options.
| |||||||||||
Constructs a storage backend using the provided Ehcache
with the given configuration options.
| |||||||||||
Constructs a storage backend using the provided Ehcache
with the given configuration options, but using an alternative
cache entry serialization strategy.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Retrieves the cache entry stored under the given key
or null if no entry exists under that key.
| |||||||||||
Store a given cache entry under the given key.
| |||||||||||
Deletes/invalidates/removes any cache entries currently
stored under the given key.
| |||||||||||
Atomically applies the given callback to update an existing cache
entry under a given key.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.apache.http.client.cache.HttpCacheStorage
|
Constructs a storage backend using the provided Ehcache with default configuration options.
cache | where to store cached origin responses |
---|
Constructs a storage backend using the provided Ehcache with the given configuration options.
cache | where to store cached origin responses |
---|---|
config | cache storage configuration options - note that the setting for max object size will be ignored and should be configured in the Ehcache instead. |
Constructs a storage backend using the provided Ehcache with the given configuration options, but using an alternative cache entry serialization strategy.
cache | where to store cached origin responses |
---|---|
config | cache storage configuration options - note that the setting for max object size will be ignored and should be configured in the Ehcache instead. |
serializer | alternative serialization mechanism |
Retrieves the cache entry stored under the given key or null if no entry exists under that key.
key | cache key |
---|
HttpCacheEntry
or null
if no
entry existsIOException |
---|
Store a given cache entry under the given key.
key | where in the cache to store the entry |
---|---|
entry | cached response to store |
IOException |
---|
Deletes/invalidates/removes any cache entries currently stored under the given key.
Atomically applies the given callback to update an existing cache entry under a given key.
key | indicates which entry to modify |
---|---|
callback | performs the update; see
HttpCacheUpdateCallback for details, but roughly the
callback expects to be handed the current entry and will return
the new value for the entry. |