java.lang.Object | |
↳ | org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage |
This class is a storage backend that uses an external memcached for storing cached origin responses. This storage option provides a couple of interesting advantages over the default in-memory storage backend:
Please refer to the memcached documentation and in particular to the documentation for the spymemcached documentation for details about how to set up and configure memcached and the Java client used here, respectively.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a storage backend talking to a memcached instance
listening on the specified host and port.
| |||||||||||
Create a storage backend using the pre-configured given
memcached client.
| |||||||||||
Create a storage backend using the given memcached client and
applying the given cache configuration and cache entry serialization
mechanism.
|
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
|
Create a storage backend talking to a memcached instance listening on the specified host and port. This is useful if you just have a single local memcached instance running on the same machine as your application, for example.
address | where the memcached daemon is running |
---|
IOException |
---|
Create a storage backend using the pre-configured given memcached client.
cache | client to use for communicating with memcached |
---|
Create a storage backend using the given memcached client and applying the given cache configuration and cache entry serialization mechanism.
client | how to talk to memcached |
---|---|
config | apply HTTP cache-related options |
serializer | how to serialize the cache entries before writing
them out to memcached. The provided DefaultHttpCacheEntrySerializer is a fine serialization mechanism
to use here.
|
Retrieves the cache entry stored under the given key or null if no entry exists under that key.
url | cache key |
---|
HttpCacheEntry
or null
if no
entry existsIOException |
---|
Store a given cache entry under the given key.
url | 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.
IOException |
---|
Atomically applies the given callback to update an existing cache entry under a given key.
url | 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. |