Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
17 #ifndef APR_MEMCACHE_H
18 #define APR_MEMCACHE_H
28 #include "apr.h"
29 #include "apr_pools.h"
30 #include "apr_time.h"
31 #include "apr_strings.h"
32 #include "apr_network_io.h"
33 #include "apr_buckets.h"
34 #include "apr_ring.h"
35 #include "apr_reslist.h"
36 #include "apr_hash.h"
38 #ifdef __cplusplus
39 extern "C" {
40 #endif /* __cplusplus */
49 typedef enum
50 {
61 {
62  const char *host;
64  apr_memcache_server_status_t status;
65 #if APR_HAS_THREADS || defined(DOXYGEN)
67 #else
68  apr_memcache_conn_t *conn;
69 #endif
73 #endif
75 };
77 /* Custom hash callback function prototype, user for server selection.
78 * @param baton user selected baton
79 * @param data data to hash
80 * @param data_len length of data
81 */
82 typedef apr_uint32_t (*apr_memcache_hash_func)(void *baton,
83  const char *data,
84  const apr_size_t data_len);
88 /* Custom Server Select callback function prototype.
89 * @param baton user selected baton
90 * @param mc memcache instance, use mc->live_servers to select a node
91 * @param hash hash of the selected key.
92 */
93 typedef apr_memcache_server_t* (*apr_memcache_server_func)(void *baton,
94  apr_memcache_t *mc,
95  const apr_uint32_t hash);
99 {
105  void *hash_baton;
109 };
112 typedef struct
113 {
115  const char* key;
117  char *data;
130  const char *data,
131  const apr_size_t data_len);
137  const char *data,
138  const apr_size_t data_len);
144  const char *data,
145  const apr_size_t data_len);
155  const apr_uint32_t hash);
162  apr_memcache_t *mc,
163  const apr_uint32_t hash);
174  apr_memcache_server_t *server);
185  const char *host,
186  apr_port_t port);
219  const char *host,
220  apr_port_t port,
221  apr_uint32_t min,
222  apr_uint32_t smax,
223  apr_uint32_t max,
224  apr_uint32_t ttl,
234  apr_uint16_t max_servers,
236  apr_memcache_t **mc);
249  apr_pool_t *p,
250  const char* key,
251  char **baton,
252  apr_size_t *len,
253  apr_uint16_t *flags);
265  const char* key,
266  apr_hash_t **values);
279  apr_pool_t *temp_pool,
280  apr_pool_t *data_pool,
281  apr_hash_t *values);
293  const char *key,
294  char *baton,
295  const apr_size_t data_size,
296  apr_uint32_t timeout,
297  apr_uint16_t flags);
311  const char *key,
312  char *baton,
313  const apr_size_t data_size,
314  apr_uint32_t timeout,
315  apr_uint16_t flags);
329  const char *key,
330  char *baton,
331  const apr_size_t data_size,
332  apr_uint32_t timeout,
333  apr_uint16_t flags);
341  const char *key,
342  apr_uint32_t timeout);
352  const char *key,
353  apr_int32_t n,
354  apr_uint32_t *nv);
364  const char *key,
365  apr_int32_t n,
366  apr_uint32_t *new_value);
375  apr_pool_t *p,
376  char **baton);
378 typedef struct
379 {
381  const char *version;
434  apr_pool_t *p,
435  apr_memcache_stats_t **stats);
440 #ifdef __cplusplus
441 }
442 #endif
444 #endif /* APR_MEMCACHE_H */
size_t apr_size_t
Definition: apr.h:393
void * server_baton
Definition: apr_memcache.h:107
APR Network library.
apr_uint16_t ntotal
Definition: apr_memcache.h:102
Definition: apr_memcache.h:98
apr_uint32_t total_connections
Definition: apr_memcache.h:403
apr_uint32_t flags
Definition: apr_memcache.h:100
apr_memcache_hash_func hash_func
Definition: apr_memcache.h:106
Definition: apr_arch_thread_mutex.h:28
apr_status_t status
Definition: apr_memcache.h:114
apr_uint16_t nalloc
Definition: apr_memcache.h:101
apr_status_t apr_memcache_decr(apr_memcache_t *mc, const char *key, apr_int32_t n, apr_uint32_t *new_value)
apr_uint64_t evictions
Definition: apr_memcache.h:416
struct apr_reslist_t apr_reslist_t
Definition: apr_reslist.h:42
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)
void * hash_baton
Definition: apr_memcache.h:105
apr_uint32_t connection_structures
Definition: apr_memcache.h:405
apr_status_t apr_memcache_enable_server(apr_memcache_t *mc, apr_memcache_server_t *ms)
apr_uint32_t limit_maxbytes
Definition: apr_memcache.h:422
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)
apr_uint32_t threads
Definition: apr_memcache.h:424
apr_size_t len
Definition: apr_memcache.h:116
Definition: apr_memcache.h:60
APR Hash Tables.
apr_uint32_t pointer_size
Definition: apr_memcache.h:389
apr_memcache_server_t * apr_memcache_find_server_hash_default(void *baton, apr_memcache_t *mc, const apr_uint32_t hash)
apr_uint32_t get_hits
Definition: apr_memcache.h:411
apr_uint32_t apr_memcache_hash(apr_memcache_t *mc, const char *data, const apr_size_t data_len)
APR-UTIL Resource List Routines.
apr_uint32_t get_misses
Definition: apr_memcache.h:413
apr_uint32_t curr_items
Definition: apr_memcache.h:395
unsigned short apr_uint16_t
Definition: apr.h:344
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)
apr_status_t apr_memcache_stats(apr_memcache_server_t *ms, apr_pool_t *p, apr_memcache_stats_t **stats)
apr_int64_t apr_time_t
Definition: apr_time.h:45
APR memory allocation.
const char * version
Definition: apr_memcache.h:381
uint64_t apr_uint64_t
Definition: apr.h:386
apr_status_t apr_memcache_disable_server(apr_memcache_t *mc, apr_memcache_server_t *ms)
apr_time_t rusage_system
Definition: apr_memcache.h:393
apr_status_t apr_memcache_create(apr_pool_t *p, apr_uint16_t max_servers, apr_uint32_t flags, apr_memcache_t **mc)
const char * key
Definition: apr_memcache.h:115
apr_uint32_t curr_connections
Definition: apr_memcache.h:401
apr_pool_t * p
Definition: apr_memcache.h:104
void apr_memcache_add_multget_key(apr_pool_t *data_pool, const char *key, apr_hash_t **values)
APR-UTIL Buckets/Bucket Brigades.
apr_uint64_t bytes_written
Definition: apr_memcache.h:420
unsigned int apr_uint32_t
Definition: apr.h:347
APR Platform Definitions.
struct apr_hash_t apr_hash_t
Definition: apr_hash.h:52
apr_port_t port
Definition: apr_memcache.h:63
apr_memcache_server_t ** live_servers
Definition: apr_memcache.h:103
struct apr_memcache_conn_t apr_memcache_conn_t
Definition: apr_memcache.h:56
apr_uint32_t(* apr_memcache_hash_func)(void *baton, const char *data, const apr_size_t data_len)
Definition: apr_memcache.h:82
apr_uint32_t cmd_get
Definition: apr_memcache.h:407
Definition: apr_memcache.h:112
apr_uint32_t total_items
Definition: apr_memcache.h:397
apr_memcache_server_t *(* apr_memcache_server_func)(void *baton, apr_memcache_t *mc, const apr_uint32_t hash)
Definition: apr_memcache.h:93
apr_time_t time
Definition: apr_memcache.h:387
Definition: apr_memcache.h:378
apr_status_t apr_memcache_incr(apr_memcache_t *mc, const char *key, apr_int32_t n, apr_uint32_t *nv)
#define APR_DECLARE(x)
Definition: macros.h:6
APR Strings library.
apr_time_t rusage_user
Definition: apr_memcache.h:391
apr_time_t btime
Definition: apr_memcache.h:74
apr_uint32_t apr_memcache_hash_crc32(void *baton, const char *data, const apr_size_t data_len)
apr_pool_t * p
Definition: apr_memcache.h:70
apr_memcache_server_status_t status
Definition: apr_memcache.h:64
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
Definition: apr_memcache.h:52
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)
int apr_status_t
Definition: apr_errno.h:44
apr_uint16_t apr_port_t
Definition: apr_network_io.h:257
APR Time Library.
Definition: apr_memcache.h:49
char * data
Definition: apr_memcache.h:117
apr_uint32_t cmd_set
Definition: apr_memcache.h:409
apr_uint32_t apr_memcache_hash_default(void *baton, const char *data, const apr_size_t data_len)
apr_uint64_t bytes_read
Definition: apr_memcache.h:418
int ns
Definition: mod_dav.h:587
apr_thread_mutex_t * lock
Definition: apr_memcache.h:72
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)
dav_resource int dav_locktoken dav_response int flags
Definition: mod_dav.h:1452
apr_uint16_t flags
Definition: apr_memcache.h:118
apr_status_t apr_memcache_multgetp(apr_memcache_t *mc, apr_pool_t *temp_pool, apr_pool_t *data_pool, apr_hash_t *values)
apr_uint64_t bytes
Definition: apr_memcache.h:399
apr_status_t apr_memcache_delete(apr_memcache_t *mc, const char *key, apr_uint32_t timeout)
apr_memcache_server_t * apr_memcache_find_server_hash(apr_memcache_t *mc, const apr_uint32_t hash)
const char * host
Definition: apr_memcache.h:62
apr_uint32_t uptime
Definition: apr_memcache.h:385
apr_reslist_t * conns
Definition: apr_memcache.h:66
apr_uint32_t pid
Definition: apr_memcache.h:383
apr_memcache_server_t * apr_memcache_find_server(apr_memcache_t *mc, const char *host, apr_port_t port)
apr_status_t apr_memcache_add_server(apr_memcache_t *mc, apr_memcache_server_t *server)
Definition: apr_memcache.h:51
apr_memcache_server_func server_func
Definition: apr_memcache.h:108
APR Rings.
apr_status_t apr_memcache_version(apr_memcache_server_t *ms, apr_pool_t *p, char **baton)
int apr_int32_t
Definition: apr.h:346