123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444 |
- #ifndef APR_MEMCACHE_H
- #define APR_MEMCACHE_H
- #include "apr.h"
- #include "apr_pools.h"
- #include "apr_time.h"
- #include "apr_strings.h"
- #include "apr_network_io.h"
- #include "apr_ring.h"
- #include "apr_buckets.h"
- #include "apr_reslist.h"
- #include "apr_hash.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef enum
- {
- APR_MC_SERVER_LIVE,
- APR_MC_SERVER_DEAD
- } apr_memcache_server_status_t;
- typedef struct apr_memcache_conn_t apr_memcache_conn_t;
- typedef struct apr_memcache_server_t apr_memcache_server_t;
- struct apr_memcache_server_t
- {
- const char *host;
- apr_port_t port;
- apr_memcache_server_status_t status;
- #if APR_HAS_THREADS || defined(DOXYGEN)
- apr_reslist_t *conns;
- #else
- apr_memcache_conn_t *conn;
- #endif
- apr_pool_t *p;
- #if APR_HAS_THREADS
- apr_thread_mutex_t *lock;
- #endif
- apr_time_t btime;
- };
- typedef apr_uint32_t (*apr_memcache_hash_func)(void *baton,
- const char *data,
- const apr_size_t data_len);
- typedef struct apr_memcache_t apr_memcache_t;
- typedef apr_memcache_server_t* (*apr_memcache_server_func)(void *baton,
- apr_memcache_t *mc,
- const apr_uint32_t hash);
- struct apr_memcache_t
- {
- apr_uint32_t flags;
- apr_uint16_t nalloc;
- apr_uint16_t ntotal;
- apr_memcache_server_t **live_servers;
- apr_pool_t *p;
- void *hash_baton;
- apr_memcache_hash_func hash_func;
- void *server_baton;
- apr_memcache_server_func server_func;
- };
- typedef struct
- {
- apr_status_t status;
- const char* key;
- apr_size_t len;
- char *data;
- apr_uint16_t flags;
- } apr_memcache_value_t;
- APU_DECLARE(apr_uint32_t) apr_memcache_hash(apr_memcache_t *mc,
- const char *data,
- const apr_size_t data_len);
- APU_DECLARE(apr_uint32_t) apr_memcache_hash_crc32(void *baton,
- const char *data,
- const apr_size_t data_len);
- APU_DECLARE(apr_uint32_t) apr_memcache_hash_default(void *baton,
- const char *data,
- const apr_size_t data_len);
- APU_DECLARE(apr_memcache_server_t *) apr_memcache_find_server_hash(apr_memcache_t *mc,
- const apr_uint32_t hash);
- APU_DECLARE(apr_memcache_server_t *) apr_memcache_find_server_hash_default(void *baton,
- apr_memcache_t *mc,
- const apr_uint32_t hash);
- APU_DECLARE(apr_status_t) apr_memcache_add_server(apr_memcache_t *mc,
- apr_memcache_server_t *server);
- APU_DECLARE(apr_memcache_server_t *) apr_memcache_find_server(apr_memcache_t *mc,
- const char *host,
- apr_port_t port);
- APU_DECLARE(apr_status_t) apr_memcache_enable_server(apr_memcache_t *mc,
- apr_memcache_server_t *ms);
- APU_DECLARE(apr_status_t) apr_memcache_disable_server(apr_memcache_t *mc,
- apr_memcache_server_t *ms);
- APU_DECLARE(apr_status_t) apr_memcache_server_create(apr_pool_t *p,
- const char *host,
- apr_port_t port,
- apr_uint32_t min,
- apr_uint32_t smax,
- apr_uint32_t max,
- apr_uint32_t ttl,
- apr_memcache_server_t **ns);
- APU_DECLARE(apr_status_t) apr_memcache_create(apr_pool_t *p,
- apr_uint16_t max_servers,
- apr_uint32_t flags,
- apr_memcache_t **mc);
- APU_DECLARE(apr_status_t) apr_memcache_getp(apr_memcache_t *mc,
- apr_pool_t *p,
- const char* key,
- char **baton,
- apr_size_t *len,
- apr_uint16_t *flags);
- APU_DECLARE(void) apr_memcache_add_multget_key(apr_pool_t *data_pool,
- const char* key,
- apr_hash_t **values);
- APU_DECLARE(apr_status_t) apr_memcache_multgetp(apr_memcache_t *mc,
- apr_pool_t *temp_pool,
- apr_pool_t *data_pool,
- apr_hash_t *values);
- APU_DECLARE(apr_status_t) apr_memcache_set(apr_memcache_t *mc,
- const char *key,
- char *baton,
- const apr_size_t data_size,
- apr_uint32_t timeout,
- apr_uint16_t flags);
- APU_DECLARE(apr_status_t) apr_memcache_add(apr_memcache_t *mc,
- const char *key,
- char *baton,
- const apr_size_t data_size,
- apr_uint32_t timeout,
- apr_uint16_t flags);
- APU_DECLARE(apr_status_t) apr_memcache_replace(apr_memcache_t *mc,
- const char *key,
- char *baton,
- const apr_size_t data_size,
- apr_uint32_t timeout,
- apr_uint16_t flags);
- APU_DECLARE(apr_status_t) apr_memcache_delete(apr_memcache_t *mc,
- const char *key,
- apr_uint32_t timeout);
- APU_DECLARE(apr_status_t) apr_memcache_incr(apr_memcache_t *mc,
- const char *key,
- apr_int32_t n,
- apr_uint32_t *nv);
- APU_DECLARE(apr_status_t) apr_memcache_decr(apr_memcache_t *mc,
- const char *key,
- apr_int32_t n,
- apr_uint32_t *new_value);
- APU_DECLARE(apr_status_t) apr_memcache_version(apr_memcache_server_t *ms,
- apr_pool_t *p,
- char **baton);
- typedef struct
- {
-
- const char *version;
-
- apr_uint32_t pid;
-
- apr_uint32_t uptime;
-
- apr_time_t time;
-
- apr_uint32_t pointer_size;
-
- apr_time_t rusage_user;
-
- apr_time_t rusage_system;
-
- apr_uint32_t curr_items;
-
- apr_uint32_t total_items;
-
- apr_uint64_t bytes;
-
- apr_uint32_t curr_connections;
-
- apr_uint32_t total_connections;
-
- apr_uint32_t connection_structures;
-
- apr_uint32_t cmd_get;
-
- apr_uint32_t cmd_set;
-
- apr_uint32_t get_hits;
-
- apr_uint32_t get_misses;
-
- apr_uint64_t evictions;
-
- apr_uint64_t bytes_read;
-
- apr_uint64_t bytes_written;
-
- apr_uint32_t limit_maxbytes;
-
- apr_uint32_t threads;
- } apr_memcache_stats_t;
- APU_DECLARE(apr_status_t) apr_memcache_stats(apr_memcache_server_t *ms,
- apr_pool_t *p,
- apr_memcache_stats_t **stats);
- #ifdef __cplusplus
- }
- #endif
- #endif
|