1 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
5 * Copyright (C) 2012 Data Differential, http://datadifferential.com/
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following disclaimer
16 * in the documentation and/or other materials provided with the
19 * * The names of its contributors may not be used to endorse or
20 * promote products derived from this software without specific prior
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #include <libmemcached/common.h>
39 bool memcached_flag(const memcached_st
& memc
, const memcached_flag_t flag
)
43 case MEMCACHED_FLAG_AUTO_EJECT_HOSTS
:
44 return memcached_is_auto_eject_hosts(&memc
);
46 case MEMCACHED_FLAG_BINARY_PROTOCOL
:
47 return memcached_is_binary(&memc
);
49 case MEMCACHED_FLAG_BUFFER_REQUESTS
:
50 return memcached_is_buffering(&memc
);
52 case MEMCACHED_FLAG_HASH_WITH_NAMESPACE
:
53 return memcached_is_hash_with_namespace(&memc
);
55 case MEMCACHED_FLAG_NO_BLOCK
:
56 return memcached_is_no_block(&memc
);
58 case MEMCACHED_FLAG_REPLY
:
59 return memcached_is_replying(&memc
);
61 case MEMCACHED_FLAG_RANDOMIZE_REPLICA_READ
:
62 return memcached_is_randomize_replica_read(&memc
);
64 case MEMCACHED_FLAG_SUPPORT_CAS
:
65 return memcached_is_cas(&memc
);
67 case MEMCACHED_FLAG_TCP_NODELAY
:
68 return memcached_is_tcp_nodelay(&memc
);
70 case MEMCACHED_FLAG_USE_SORT_HOSTS
:
71 return memcached_is_use_sort_hosts(&memc
);
73 case MEMCACHED_FLAG_USE_UDP
:
74 return memcached_is_udp(&memc
);
76 case MEMCACHED_FLAG_VERIFY_KEY
:
77 return memcached_is_verify_key(&memc
);
79 case MEMCACHED_FLAG_TCP_KEEPALIVE
:
80 return memcached_is_use_sort_hosts(&memc
);
82 case MEMCACHED_FLAG_IS_AES
:
83 return memcached_is_aes(&memc
);
85 case MEMCACHED_FLAG_IS_FETCHING_VERSION
:
86 return memcached_is_fetching_version(&memc
);
92 void memcached_flag(memcached_st
& memc
, const memcached_flag_t flag
, const bool arg
)
96 case MEMCACHED_FLAG_AUTO_EJECT_HOSTS
:
97 memcached_set_auto_eject_hosts(memc
, arg
);
100 case MEMCACHED_FLAG_BINARY_PROTOCOL
:
101 memcached_set_binary(memc
, arg
);
104 case MEMCACHED_FLAG_BUFFER_REQUESTS
:
105 memcached_set_buffering(memc
, arg
);
108 case MEMCACHED_FLAG_HASH_WITH_NAMESPACE
:
109 memcached_set_hash_with_namespace(memc
, arg
);
112 case MEMCACHED_FLAG_NO_BLOCK
:
113 memcached_set_no_block(memc
, arg
);
116 case MEMCACHED_FLAG_REPLY
:
117 memcached_set_replying(memc
, arg
);
120 case MEMCACHED_FLAG_RANDOMIZE_REPLICA_READ
:
121 memcached_set_randomize_replica_read(memc
, arg
);
124 case MEMCACHED_FLAG_SUPPORT_CAS
:
125 memcached_set_cas(memc
, arg
);
128 case MEMCACHED_FLAG_TCP_NODELAY
:
129 memcached_set_tcp_nodelay(memc
, arg
);
132 case MEMCACHED_FLAG_USE_SORT_HOSTS
:
133 memcached_set_use_sort_hosts(memc
, arg
);
136 case MEMCACHED_FLAG_USE_UDP
:
137 memcached_set_udp(memc
, arg
);
140 case MEMCACHED_FLAG_VERIFY_KEY
:
141 memcached_set_verify_key(memc
, arg
);
144 case MEMCACHED_FLAG_TCP_KEEPALIVE
:
145 memcached_set_use_sort_hosts(memc
, arg
);
148 case MEMCACHED_FLAG_IS_AES
:
149 memcached_set_aes(memc
, arg
);
152 case MEMCACHED_FLAG_IS_FETCHING_VERSION
:
153 memcached_set_fetching_version(memc
, arg
);