2 Common include file for libmemached
12 #include <sys/types.h>
13 #include <sys/socket.h>
14 #include <netinet/in.h>
15 #include <arpa/inet.h>
23 #include <netinet/tcp.h>
25 #if TIME_WITH_SYS_TIME
26 # include <sys/time.h>
30 # include <sys/time.h>
38 #include <memcached.h>
39 #include "memcached_io.h"
41 #include <libmemcached_config.h>
43 #if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
44 #define __builtin_expect(x, expected_value) (x)
46 #define likely(x) __builtin_expect((x),1)
47 #define unlikely(x) __builtin_expect((x),0)
51 #define likely(x) if((x))
52 #define unlikely(x) if((x))
57 #define _DTRACE_VERSION 1
59 #undef _DTRACE_VERSION
62 #include "libmemcached_probes.h"
64 #define MEMCACHED_BLOCK_SIZE 1024
65 #define MEMCACHED_DEFAULT_COMMAND_SIZE 350
66 #define SMALL_STRING_LEN 1024
67 #define HUGE_STRING_LEN 8196
71 MEM_NO_BLOCK
= (1 << 0),
72 MEM_TCP_NODELAY
= (1 << 1),
73 MEM_REUSE_MEMORY
= (1 << 2),
74 MEM_USE_MD5
= (1 << 3),
75 MEM_USE_KETAMA
= (1 << 4),
76 MEM_USE_CRC
= (1 << 5),
77 MEM_USE_CACHE_LOOKUPS
= (1 << 6),
78 MEM_SUPPORT_CAS
= (1 << 7),
79 MEM_BUFFER_REQUESTS
= (1 << 8),
80 MEM_USE_SORT_HOSTS
= (1 << 9),
81 MEM_VERIFY_KEY
= (1 << 10),
85 void md5_signature(unsigned char *key
, unsigned int length
, unsigned char *result
);
86 uint32_t hash_crc32(const char *data
,
88 uint32_t hsieh_hash(char *key
, size_t key_length
);
89 uint32_t murmur_hash(char *key
, size_t key_length
);
91 memcached_return
memcached_connect(memcached_server_st
*ptr
);
92 memcached_return
memcached_response(memcached_server_st
*ptr
,
93 char *buffer
, size_t buffer_length
,
94 memcached_result_st
*result
);
95 unsigned int memcached_generate_hash(memcached_st
*ptr
, char *key
, size_t key_length
);
96 void memcached_quit_server(memcached_server_st
*ptr
, uint8_t io_death
);
98 #define memcached_server_response_increment(A) (A)->cursor_active++
99 #define memcached_server_response_decrement(A) (A)->cursor_active--
100 #define memcached_server_response_reset(A) (A)->cursor_active=0
102 memcached_return
memcached_do(memcached_server_st
*ptr
, char *commmand
,
103 size_t command_length
, uint8_t with_flush
);
104 memcached_return
memcached_version(memcached_st
*ptr
);
105 memcached_return
value_fetch(memcached_server_st
*ptr
,
107 memcached_result_st
*result
);
108 void server_list_free(memcached_st
*ptr
, memcached_server_st
*servers
);
110 memcached_return
memcachd_key_test(char **keys
, size_t *key_length
,
111 unsigned int number_of_keys
);
113 #endif /* __COMMON_H__ */