1 Generating hash values directly
2 ===============================
4 .. index:: object: memcached_st
11 #include <libmemcached/memcached.h>
13 .. type:: memcached_hash_t
15 .. function:: uint32_t memcached_generate_hash_value (const char *key, size_t key_length, memcached_hash_t hash_algorithm)
17 .. function:: uint32_t memcached_generate_hash (memcached_st *ptr, const char *key, size_t key_length)
19 .. type:: MEMCACHED_HASH_DEFAULT
21 .. type:: MEMCACHED_HASH_MD5
23 .. type:: MEMCACHED_HASH_CRC
25 .. type:: MEMCACHED_HASH_FNV1_64
27 .. type:: MEMCACHED_HASH_FNV1A_64
29 .. type:: MEMCACHED_HASH_FNV1_32
31 .. type:: MEMCACHED_HASH_FNV1A_32
33 .. type:: MEMCACHED_HASH_JENKINS
35 .. type:: MEMCACHED_HASH_MURMUR
37 .. type:: MEMCACHED_HASH_HSIEH
39 .. type:: MEMCACHED_HASH_MURMUR3
41 Compile and link with -lmemcachedutil -lmemcached
46 :func:`memcached_generate_hash_value` allows you to hash a key using one of
47 the hash functions defined in the library. This method is provided for
48 the convenience of higher-level language bindings and is not necessary
49 for normal memcache operations.
51 The allowed hash algorithm constants are listed in the manpage for
52 :func:`memcached_behavior_set`.
54 :func:`memcached_generate_hash` takes a :type:`memcached_st` structure
55 and produces the hash value that would have been generated based on the
56 defaults of :type:`memcached_st`.
58 As of version 0.36 all hash methods have been placed into the library
59 libhashkit(3) which is linked with libmemcached(3). For more information please see its documentation.
64 A 32-bit integer which is the result of hashing the given key.
65 For 64-bit hash algorithms, only the least-significant 32 bits are
73 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`