2 * Summary: interface for memcached server
3 * Description: main include file for libmemcached
5 * Copy: See Copyright for the status of this software.
10 #ifndef __MEMCACHED_H__
11 #define __MEMCACHED_H__
15 #include <sys/types.h>
16 #include <netinet/in.h>
18 #ifdef MEMCACHED_INTERNAL
19 #include <libmemcached/libmemcached_config.h>
21 #include <libmemcached/memcached_constants.h>
22 #include <libmemcached/memcached_types.h>
23 #include <libmemcached/memcached_watchpoint.h>
24 #include <libmemcached/memcached_get.h>
25 #include <libmemcached/memcached_server.h>
26 #include <libmemcached/memcached_string.h>
27 #include <libmemcached/memcached_result.h>
33 /* These are Private and should not be used by applications */
34 #define MEMCACHED_VERSION_STRING_LENGTH 12
37 struct memcached_continuum_item_st
{
42 #define LIBMEMCACHED_VERSION_STRING "0.25"
44 struct memcached_stat_st
{
49 uint32_t pointer_size
;
50 uint32_t rusage_user_seconds
;
51 uint32_t rusage_user_microseconds
;
52 uint32_t rusage_system_seconds
;
53 uint32_t rusage_system_microseconds
;
56 uint64_t limit_maxbytes
;
57 uint32_t curr_connections
;
58 uint32_t total_connections
;
59 uint32_t connection_structures
;
67 uint64_t bytes_written
;
68 char version
[MEMCACHED_VERSION_STRING_LENGTH
];
72 memcached_allocated is_allocated
;
73 memcached_server_st
*hosts
;
74 uint32_t number_of_hosts
;
75 uint32_t cursor_server
;
81 int32_t connect_timeout
;
82 int32_t retry_timeout
;
83 memcached_result_st result
;
85 memcached_server_distribution distribution
;
87 uint32_t continuum_count
;
88 memcached_continuum_item_st
*continuum
;
89 memcached_clone_func on_clone
;
90 memcached_cleanup_func on_cleanup
;
91 memcached_free_function call_free
;
92 memcached_malloc_function call_malloc
;
93 memcached_realloc_function call_realloc
;
94 memcached_trigger_key get_key_failure
;
95 memcached_trigger_delete_key delete_trigger
;
96 char prefix_key
[MEMCACHED_PREFIX_KEY_MAX_SIZE
];
97 size_t prefix_key_length
;
98 memcached_hash hash_continuum
;
99 uint32_t continuum_points_counter
;
102 uint32_t server_failure_limit
;
103 uint32_t io_msg_watermark
;
104 uint32_t io_bytes_watermark
;
110 const char * memcached_lib_version(void);
112 memcached_st
*memcached_create(memcached_st
*ptr
);
113 void memcached_free(memcached_st
*ptr
);
114 memcached_st
*memcached_clone(memcached_st
*clone
, memcached_st
*ptr
);
116 memcached_return
memcached_delete(memcached_st
*ptr
, const char *key
, size_t key_length
,
118 memcached_return
memcached_increment(memcached_st
*ptr
,
119 const char *key
, size_t key_length
,
122 memcached_return
memcached_decrement(memcached_st
*ptr
,
123 const char *key
, size_t key_length
,
126 void memcached_stat_free(memcached_st
*, memcached_stat_st
*);
127 memcached_stat_st
*memcached_stat(memcached_st
*ptr
, char *args
, memcached_return
*error
);
128 memcached_return
memcached_stat_servername(memcached_stat_st
*stat
, char *args
,
129 char *hostname
, unsigned int port
);
130 memcached_return
memcached_flush(memcached_st
*ptr
, time_t expiration
);
131 memcached_return
memcached_verbosity(memcached_st
*ptr
, unsigned int verbosity
);
132 void memcached_quit(memcached_st
*ptr
);
133 char *memcached_strerror(memcached_st
*ptr
, memcached_return rc
);
134 memcached_return
memcached_behavior_set(memcached_st
*ptr
, memcached_behavior flag
, uint64_t data
);
135 uint64_t memcached_behavior_get(memcached_st
*ptr
, memcached_behavior flag
);
137 /* Server Public functions */
139 memcached_return
memcached_server_add_udp(memcached_st
*ptr
,
140 const char *hostname
,
142 memcached_return
memcached_server_add_unix_socket(memcached_st
*ptr
,
143 const char *filename
);
144 memcached_return
memcached_server_add(memcached_st
*ptr
, const char *hostname
,
147 memcached_return
memcached_server_add_udp_with_weight(memcached_st
*ptr
,
148 const char *hostname
,
151 memcached_return
memcached_server_add_unix_socket_with_weight(memcached_st
*ptr
,
152 const char *filename
,
154 memcached_return
memcached_server_add_with_weight(memcached_st
*ptr
, const char *hostname
,
157 void memcached_server_list_free(memcached_server_st
*ptr
);
158 memcached_return
memcached_server_push(memcached_st
*ptr
, memcached_server_st
*list
);
160 memcached_server_st
*memcached_server_list_append(memcached_server_st
*ptr
,
161 const char *hostname
,
163 memcached_return
*error
);
164 memcached_server_st
*memcached_server_list_append_with_weight(memcached_server_st
*ptr
,
165 const char *hostname
,
168 memcached_return
*error
);
169 unsigned int memcached_server_list_count(memcached_server_st
*ptr
);
170 memcached_server_st
*memcached_servers_parse(char *server_strings
);
172 char *memcached_stat_get_value(memcached_st
*ptr
, memcached_stat_st
*stat
,
173 char *key
, memcached_return
*error
);
174 char ** memcached_stat_get_keys(memcached_st
*ptr
, memcached_stat_st
*stat
,
175 memcached_return
*error
);
177 memcached_return
memcached_delete_by_key(memcached_st
*ptr
,
178 const char *master_key
, size_t master_key_length
,
179 const char *key
, size_t key_length
,
182 memcached_return
memcached_fetch_execute(memcached_st
*ptr
,
183 memcached_execute_function
*callback
,
185 unsigned int number_of_callbacks
);
187 memcached_return
memcached_callback_set(memcached_st
*ptr
,
188 memcached_callback flag
,
190 void *memcached_callback_get(memcached_st
*ptr
,
191 memcached_callback flag
,
192 memcached_return
*error
);
199 #include <libmemcached/memcached_storage.h>
201 #endif /* __MEMCACHED_H__ */