2 +--------------------------------------------------------------------+
3 | libmemcached - C/C++ Client Library for memcached |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted under the terms of the BSD license. |
7 | You should have received a copy of the license in a bundled file |
8 | named LICENSE; in case you did not receive a copy you can review |
9 | the terms online at: https://opensource.org/licenses/BSD-3-Clause |
10 +--------------------------------------------------------------------+
11 | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
12 | Copyright (c) 2020 Michael Wallner <mike@php.net> |
13 +--------------------------------------------------------------------+
18 #include <libhashkit-1.0/hashkit.h>
23 Hashkit() { hashkit_create(&self); }
25 Hashkit(const Hashkit &source) { hashkit_clone(&self, &source.self); }
27 Hashkit &operator=(const Hashkit &source) {
29 hashkit_clone(&self, &source.self);
34 friend bool operator==(const Hashkit &left, const Hashkit &right) {
35 return hashkit_compare(&left.self, &right.self);
38 uint32_t digest(std::string &str) { return hashkit_digest(&self, str.c_str(), str.length()); }
40 uint32_t digest(const char *key, size_t key_length) {
41 return hashkit_digest(&self, key, key_length);
44 hashkit_return_t set_function(hashkit_hash_algorithm_t hash_algorithm) {
45 return hashkit_set_function(&self, hash_algorithm);
48 hashkit_return_t set_distribution_function(hashkit_hash_algorithm_t hash_algorithm) {
49 return hashkit_set_distribution_function(&self, hash_algorithm);
52 ~Hashkit() { hashkit_free(&self); }