memcached_version.pod\\r
memflush.pod\\r
memcached_flush_buffers.pod\\r
- memcached_analyze.pod\r
+ memcached_analyze.pod\\r
+ memcached_generate_hash_value.pod\r
\r
man_MANS = libmemcached.3\\r
libmemcached_examples.3\\r
memcached_verbosity.3\\r
memcached_lib_version.3\\r
memcached_version.3\\r
- memcached_flush_buffers.3\r
+ memcached_flush_buffers.3\\r
+ memcached_generate_hash_value.3\r
\r
libmemcached.3: libmemcached.pod \r
@POD2MAN@ -c "libmemcached" -r "" -s 3 libmemcached.pod > libmemcached.3\r
memcached_analyze.3: memcached_analyze.pod\r
@POD2MAN@ -c "libmemcached" -r "" -s 3 memcached_analyze.pod > memcached_analyze.3\r
\r
+memcached_generate_hash_value.3: memcached_generate_hash_value.pod\r
+ @POD2MAN@ -c "libmemcached" -r "" -s 3 memcached_generate_hash_value.pod > memcached_generate_hash_value.3\r
+\r
memcp.1: memcp.pod\r
@POD2MAN@ -c "libmemcached" -r "" -s 1 memcp.pod > memcp.1\r
\r
--- /dev/null
+=head1 NAME
+
+memcached_generate_hash_value
+
+=head1 LIBRARY
+
+C Client Library for memcached (libmemcached, -lmemcached)
+
+=head1 SYNOPSIS
+
+ #include <memcached.h>
+
+ uint32_t
+ memcached_generate_hash_value (const char *key,
+ size_t key_length,
+ memcached_hash hash_algorithm);
+
+=head1 DESCRIPTION
+
+memcached_generate_hash_value() allows you to hash a key using one of
+the hash fuctions defined in the library. This method is provided for
+the convenience of higher-level language bindings and is not necessary
+for normal memcache operations.
+
+The allowed hash algorithm constants are listed in the manpage for
+memcached_behavior_set().
+
+=head1 RETURN
+
+A 32-bit integer which is the result of hashing the given key.
+For 64-bit hash algorithms, only the least-significant 32 bits are
+returned.
+
+=head1 HOME
+
+To find out more information please check:
+L<http://tangent.org/552/libmemcached.html>
+
+=head1 AUTHOR
+
+Brian Aker, E<lt>brian@tangent.orgE<gt>
+
+=head1 SEE ALSO
+
+memcached(1) libmemcached(3) memcached_behavior_set(3)
+
+=cut
+
memcached_return run_distribution(memcached_st *ptr);
-uint32_t generate_hash_value(const char *key, size_t key_length, memcached_hash hash_algorithm);
-
uint32_t generate_hash(memcached_st *ptr, const char *key, size_t key_length);
memcached_return memcached_server_remove(memcached_server_st *st_ptr);
}
else
{
- unlikely (key_length > 250)
+ unlikely (key_length >= MEMCACHED_MAX_KEY)
return MEMCACHED_BAD_KEY_PROVIDED;
}
char *memcached_strerror(memcached_st *ptr, memcached_return rc);
memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavior flag, uint64_t data);
uint64_t memcached_behavior_get(memcached_st *ptr, memcached_behavior flag);
+uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memcached_hash hash_algorithm);
memcached_return memcached_flush_buffers(memcached_st *mem);
/* Server Public functions */
static uint32_t internal_generate_hash(const char *key, size_t key_length);
static uint32_t internal_generate_md5(const char *key, size_t key_length);
-uint32_t generate_hash_value(const char *key, size_t key_length, memcached_hash hash_algorithm)
+uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memcached_hash hash_algorithm)
{
uint32_t hash= 1; /* Just here to remove compile warning */
uint32_t x= 0;
if (ptr->number_of_hosts == 1)
return 0;
- hash= generate_hash_value(key, key_length, ptr->hash);
+ hash= memcached_generate_hash_value(key, key_length, ptr->hash);
WATCHPOINT_ASSERT(hash);
return hash;
}
}
else
{
- value= generate_hash_value(sort_host, sort_host_length, ptr->hash_continuum);
+ value= memcached_generate_hash_value(sort_host, sort_host_length, ptr->hash_continuum);
ptr->continuum[continuum_index].index= host_index;
ptr->continuum[continuum_index++].value= value;
}