3da05dfd87a7f48551af4986c1a88ebb3cc02797
[m6w6/libmemcached] / docs / memcached_generate_hash_value.rst
1 ===============================
2 Generating hash values directly
3 ===============================
4
5 .. index:: object: memcached_st
6
7 Hash a key value
8
9
10 --------
11 SYNOPSIS
12 --------
13
14
15 #include <libmemcached/memcached.h>
16
17 .. c:function:: uint32_t memcached_generate_hash_value (const char *key, size_t key_length, memcached_hash_t hash_algorithm);
18
19 .. c:function:: uint32_t memcached_generate_hash (memcached_st *ptr, const char *key, size_t key_length);
20
21 Compile and link with -lmemcachedutil -lmemcached
22
23
24 -----------
25 DESCRIPTION
26 -----------
27
28
29 :c:func:`memcached_generate_hash_value()` allows you to hash a key using one of
30 the hash functions defined in the library. This method is provided for
31 the convenience of higher-level language bindings and is not necessary
32 for normal memcache operations.
33
34 The allowed hash algorithm constants are listed in the manpage for
35 :c:func:`memcached_behavior_set()`.
36
37 :c:func:`memcached_generate_hash()` takes a :c:type:`memcached_st` struture
38 and produces the hash value that would have been generated based on the
39 defaults of the :c:type:`memcached_st structure`.
40
41 As of version 0.36 all hash methods have been placed into the library
42 libhashkit(3) which is linked with libmemcached(3). For more information please see its documentation.
43
44
45 ------
46 RETURN
47 ------
48
49
50 A 32-bit integer which is the result of hashing the given key.
51 For 64-bit hash algorithms, only the least-significant 32 bits are
52 returned.
53
54
55 ----
56 HOME
57 ----
58
59
60 To find out more information please check:
61 `http://libmemcached.org/ <http://libmemcached.org/>`_
62
63
64 ------
65 AUTHOR
66 ------
67
68
69 Brian Aker, <brian@tangent.org>
70
71
72 --------
73 SEE ALSO
74 --------
75
76
77 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`