Class PrefixKeyHashingScheme

  • All Implemented Interfaces:

    public class PrefixKeyHashingScheme
    extends java.lang.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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String hash​(java.lang.String storageKey)
      Maps a storage key to a cache key.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrefixKeyHashingScheme

        public PrefixKeyHashingScheme​(java.lang.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.
        prefix -
        backingScheme -
    • Method Detail

      • hash

        public java.lang.String hash​(java.lang.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
        storageKey - what the higher-level HTTP cache wants to use as its key for looking up cache entries
        a cache key suitable for use with memcached