-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmc_result_handle.h
More file actions
69 lines (52 loc) · 1.29 KB
/
mc_result_handle.h
File metadata and controls
69 lines (52 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef INCLUDED_MC_RESULT_HANDLE
#define INCLUDED_MC_RESULT_HANDLE
#include <memory>
#include <libmemcached/memcached.h>
namespace com
{
namespace osada
{
class McResultHandle
{
//std::allocator d_allocator;
memcached_result_st *d_result;
public:
McResultHandle(const memcached_st* p_memc) {
if (memcached_result_create(p_memc,d_result) == NULL) {
throw std::runtime_error("Could not allocate memcached result st");
}
}
virtual ~McResultHandle() {
memcached_result_free(d_result);
}
const char * keyValue() {
return memcached_result_key_value(d_result);
}
size_t keyLength() {
return memcached_result_key_length(d_result);
}
const char * resultValue() {
return memcached_result_value(d_result);
}
size_t resultLen() {
return memcached_result_length(d_result);
}
uint32_t resultFlags() {
return memcached_result_flags(d_result);
}
uint64_t resultCAS() {
return memcached_result_cas(d_result);
}
memcached_return_t setValue(const char *p_value, size_t p_length) {
return memcached_result_set_value(d_result, p_value, p_length);
}
void setFlags(uint32_t flags) {
memcached_result_set_flags(d_result, flags);
}
void setExpiration(time_t timeToExp) {
memcached_result_set_expiration(d_result, timeToExp);
}
};
}
}
#endif // INCLUDED_MC_RESULT_HANDLE