1 #include "libmemcached/memcached.h"
8 memcached_result_st result;
12 Memcached() : memc(), result()
14 memcached_create(&memc);
17 Memcached(memcached_st *clone) : memc(), result()
19 memcached_clone(&memc, clone);
21 char *fetch (char *key, size_t *key_length, size_t *value_length)
26 return memcached_fetch(&memc, key, key_length,
27 value_length, &flags, &rc);
29 char *get(const char *key, size_t *value_length)
34 return memcached_get(&memc, key, strlen(key),
35 value_length, &flags, &rc);
38 char *get_by_key(const char *master_key, const char *key,
44 return memcached_get_by_key(&memc, master_key, strlen(master_key),
46 value_length, &flags, &rc);
49 memcached_return mget(char **keys, size_t *key_length,
50 unsigned int number_of_keys)
53 return memcached_mget(&memc, keys, key_length, number_of_keys);
56 memcached_return set(const char *key, const char *value, size_t value_length)
58 return memcached_set(&memc, key, strlen(key),
60 time_t(0), uint32_t(0));
63 memcached_return set_by_key(const char *master_key, const char *key,
64 const char *value, size_t value_length)
66 return memcached_set_by_key(&memc, master_key, strlen(master_key),
73 increment(const char *key, unsigned int offset, uint64_t *value)
75 return memcached_increment(&memc, key, strlen(key),
79 decrement(const char *key, unsigned int offset, uint64_t *value)
81 return memcached_decrement(&memc, key, strlen(key),
86 memcached_return add(const char *key, const char *value, size_t value_length)
88 return memcached_add(&memc, key, strlen(key), value, value_length, 0, 0);
90 memcached_return add_by_key(const char *master_key, const char *key,
91 const char *value, size_t value_length)
93 return memcached_add_by_key(&memc, master_key, strlen(master_key),
99 memcached_return replace(const char *key, const char *value,
102 return memcached_replace(&memc, key, strlen(key),
106 memcached_return replace_by_key(const char *master_key, const char *key,
107 const char *value, size_t value_length)
109 return memcached_replace_by_key(&memc, master_key, strlen(master_key),
111 value, value_length, 0, 0);
114 memcached_return prepend(const char *key, const char *value,
117 return memcached_prepend(&memc, key, strlen(key),
118 value, value_length, 0, 0);
120 memcached_return prepend_by_key(const char *master_key, const char *key,
121 const char *value, size_t value_length)
123 return memcached_prepend_by_key(&memc, master_key, strlen(master_key),
130 memcached_return append(const char *key, const char *value,
133 return memcached_append(&memc, key, strlen(key),
134 value, value_length, 0, 0);
136 memcached_return append_by_key(const char *master_key, const char *key,
137 const char *value, size_t value_length)
139 return memcached_append_by_key(&memc,
140 master_key, strlen(master_key),
142 value, value_length, 0, 0);
144 memcached_return cas(const char *key, const char *value,
145 size_t value_length, uint64_t cas)
147 return memcached_cas(&memc, key, strlen(key),
148 value, value_length, 0, 0, cas);
150 memcached_return cas_by_key(const char *master_key, const char *key,
151 const char *value, size_t value_length,
154 return memcached_cas_by_key(&memc,
155 master_key, strlen(master_key),
160 // using 'remove' vs. 'delete' since 'delete' is a keyword
161 memcached_return remove(const char *key)
163 return memcached_delete (&memc, key, strlen(key), 0);
166 memcached_return delete_by_key(const char *master_key, const char *key)
168 return memcached_delete_by_key(&memc, master_key, strlen(master_key),
169 key, strlen(key), 0);
173 memcached_free(&memc);