Package net.spy.memcached
Enum DefaultHashAlgorithm
- All Implemented Interfaces:
Serializable,Comparable<DefaultHashAlgorithm>,java.lang.constant.Constable,HashAlgorithm
Known hashing algorithms for locating a server for a key. Note that all hash
algorithms return 64-bits of hash, but only the lower 32-bits are
significant. This allows a positive 32-bit number to be returned for all
cases.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCRC_HASH as used by the perl API.32-bit FNV1.FNV hashes are designed to be fast while maintaining a low collision rate.32-bit FNV1a.Variation of FNV.SHA-384 based hash algorithm used by ketama.Native hash (String.hashCode()). -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]Get the hash digest of the given key.longCompute the hash for the given key.static DefaultHashAlgorithmReturns the enum constant of this type with the specified name.static DefaultHashAlgorithm[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NATIVE_HASH
Native hash (String.hashCode()). -
CRC_HASH
CRC_HASH as used by the perl API. This will be more consistent both across multiple API users as well as java versions, but is mostly likely significantly slower. -
FNV1_64_HASH
FNV hashes are designed to be fast while maintaining a low collision rate. The FNV speed allows one to quickly hash lots of data while maintaining a reasonable collision rate.- See Also:
-
FNV1A_64_HASH
Variation of FNV. -
FNV1_32_HASH
32-bit FNV1. -
FNV1A_32_HASH
32-bit FNV1a. -
KETAMA_HASH
SHA-384 based hash algorithm used by ketama.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
hash
Compute the hash for the given key.- Specified by:
hashin interfaceHashAlgorithm- Returns:
- a positive integer hash
-
computeHashDigest
Get the hash digest of the given key.
-