Package net.rubyeye.xmemcached
Enum HashAlgorithm
- All Implemented Interfaces:
Serializable
,Comparable<HashAlgorithm>
,java.lang.constant.Constable
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 ConstantDescriptionCRC32_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.MD5-based hash algorithm used by ketama.From lua source,it is used for long keyFrom mysql sourceNative hash (String.hashCode()).The Jenkins One-at-a-time hash ,please see http://www.burtleburtle.net/bob/hash/doobs.html -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
private static final long
private static final long
private static final long
private static ThreadLocal
<MessageDigest> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
computeMd5
(String k) Get the md5 of the given key.long
Compute the hash for the given key.static HashAlgorithm
Returns the enum constant of this type with the specified name.static HashAlgorithm[]
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()). -
CRC32_HASH
CRC32_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. -
FNV1A_64_HASH
Variation of FNV. -
FNV1_32_HASH
32-bit FNV1. -
FNV1A_32_HASH
32-bit FNV1a. -
KETAMA_HASH
MD5-based hash algorithm used by ketama. -
MYSQL_HASH
From mysql source -
ELF_HASH
-
RS_HASH
-
LUA_HASH
From lua source,it is used for long key -
ELECTION_HASH
-
ONE_AT_A_TIME
The Jenkins One-at-a-time hash ,please see http://www.burtleburtle.net/bob/hash/doobs.html
-
-
Field Details
-
FNV_64_INIT
private static final long FNV_64_INIT- See Also:
-
FNV_64_PRIME
private static final long FNV_64_PRIME- See Also:
-
FNV_32_INIT
private static final long FNV_32_INIT- See Also:
-
FNV_32_PRIME
private static final long FNV_32_PRIME- See Also:
-
md5Local
-
-
Constructor Details
-
HashAlgorithm
private HashAlgorithm()
-
-
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.- Returns:
- a positive integer hash
-
computeMd5
Get the md5 of the given key.
-