## org.apache.http.impl.client.cache.memcached
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 Summary
`PrefixKeyHashingScheme(String prefix, KeyHashingScheme backingScheme)` Creates a new `KeyHashingScheme` that prepends the given prefix to the results of hashes from the given backing scheme.

Method Summary
`String` `hash(String storageKey)` Maps a storage key to a cache key.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### 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 Detail

### 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

Copyright © 1999-2013 The Apache Software Foundation. All Rights Reserved.