Class PrefixKeyHashingScheme

java.lang.Object
org.apache.http.impl.client.cache.memcached.PrefixKeyHashingScheme
All Implemented Interfaces:
KeyHashingScheme

public class PrefixKeyHashingScheme extends Object implements 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 Details

    • PrefixKeyHashingScheme

      public PrefixKeyHashingScheme(String prefix, KeyHashingScheme backingScheme)
      Creates a new 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.
      Parameters:
      prefix -
      backingScheme -
  • Method Details

    • hash

      public String hash(String storageKey)
      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 interface KeyHashingScheme
      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