public final class PrefixKeyHashingScheme extends Object implements KeyHashingScheme
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 and Description |
---|
PrefixKeyHashingScheme(String prefix,
KeyHashingScheme backingScheme)
Creates a new
KeyHashingScheme that prepends the given
prefix to the results of hashes from the given backing scheme. |
Modifier and Type | Method and Description |
---|---|
String |
hash(String storageKey)
Maps a storage key to a cache key.
|
public PrefixKeyHashingScheme(String prefix, KeyHashingScheme backingScheme)
KeyHashingScheme
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.prefix
- backingScheme
- public String hash(String storageKey)
KeyHashingScheme
hash
in interface KeyHashingScheme
storageKey
- what the higher-level HTTP cache wants to use
as its key for looking up cache entriesCopyright © 2010–2021 The Apache Software Foundation. All rights reserved.