Class PrefixKeyHashingScheme
java.lang.Object
org.apache.http.impl.client.cache.memcached.PrefixKeyHashingScheme
- All Implemented Interfaces:
KeyHashingScheme
This is a
KeyHashingScheme
decorator that simply adds
a known prefix to the results of another KeyHashingScheme
.
Primarily useful for namespacing a shared memcached cluster, for
example.-
Constructor Summary
ConstructorsConstructorDescriptionPrefixKeyHashingScheme
(String prefix, KeyHashingScheme backingScheme) Creates a newKeyHashingScheme
that prepends the given prefix to the results of hashes from the given backing scheme. -
Method Summary
-
Constructor Details
-
PrefixKeyHashingScheme
Creates a newKeyHashingScheme
that prepends the given prefix to the results of hashes from the given backing scheme. Users should be aware that memcached has a fixed maximum key length, so the combination of this prefix plus the results of the backing hashing scheme must still fit within these limits.- Parameters:
prefix
-backingScheme
-
-
-
Method Details
-
hash
Description copied from interface:KeyHashingScheme
Maps a storage key to a cache key. The storage key is what the higher-level HTTP cache uses as a key; the cache key is what we use as a key for talking to memcached.- Specified by:
hash
in interfaceKeyHashingScheme
- Parameters:
storageKey
- what the higher-level HTTP cache wants to use as its key for looking up cache entries- Returns:
- a cache key suitable for use with memcached
-