Main Page | Modules | Data Structures | File List | Data Fields | Globals

apr_memcache.h

Go to the documentation of this file.
00001 /* Copyright 2004 Paul Querna 00002 * 00003 * Licensed under the Apache License, Version 2.0 (the "License"); 00004 * you may not use this file except in compliance with the License. 00005 * You may obtain a copy of the License at 00006 * 00007 * http://www.apache.org/licenses/LICENSE-2.0 00008 * 00009 * Unless required by applicable law or agreed to in writing, software 00010 * distributed under the License is distributed on an "AS IS" BASIS, 00011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 * See the License for the specific language governing permissions and 00013 * limitations under the License. 00014 */ 00015 00016 #ifndef APR_MEMCACHE_H 00017 #define APR_MEMCACHE_H 00018 00027 #include "apr.h" 00028 #include "apr_pools.h" 00029 #include "apr_time.h" 00030 #include "apr_strings.h" 00031 #include "apr_network_io.h" 00032 #include "apr_ring.h" 00033 #include "apr_buckets.h" 00034 #include "apr_reslist.h" 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif /* __cplusplus */ 00039 00047 typedef enum 00048 { 00049 APR_MC_SERVER_LIVE, 00050 APR_MC_SERVER_DEAD 00051 } apr_memcache_server_status_t; 00052 00054 typedef struct apr_memcache_conn_t apr_memcache_conn_t; 00055 00057 typedef struct apr_memcache_server_t apr_memcache_server_t; 00058 struct apr_memcache_server_t 00059 { 00060 const char *host; 00061 apr_port_t port; 00062 apr_memcache_server_status_t status; 00063 #if APR_HAS_THREADS || defined(DOXYGEN) 00064 apr_reslist_t *conns; 00065 #else 00066 apr_memcache_conn_t *conn; 00067 #endif 00068 apr_pool_t *p; 00069 }; 00070 00072 typedef struct 00073 { 00074 apr_uint32_t flags; 00075 apr_uint16_t nalloc; 00076 apr_uint16_t ntotal; 00077 apr_memcache_server_t **live_servers; 00078 apr_pool_t *p; 00079 } apr_memcache_t; 00080 00088 APR_DECLARE(apr_uint32_t) 00089 apr_memcache_hash(const char* data, apr_uint32_t data_len); 00090 00098 APR_DECLARE(apr_memcache_server_t *) 00099 apr_memcache_find_server_hash(apr_memcache_t *mc, const apr_uint32_t hash); 00100 00109 APR_DECLARE(apr_status_t) 00110 apr_memcache_add_server(apr_memcache_t * mc, 00111 apr_memcache_server_t *server); 00112 00113 00121 APR_DECLARE(apr_memcache_server_t *) 00122 apr_memcache_find_server(apr_memcache_t *mc, 00123 const char *host, 00124 apr_port_t port); 00125 00131 APR_DECLARE(apr_status_t) 00132 apr_memcache_enable_server(apr_memcache_t *mc, 00133 apr_memcache_server_t *ms); 00134 00135 00141 APR_DECLARE(apr_status_t) 00142 apr_memcache_disable_server(apr_memcache_t *mc, 00143 apr_memcache_server_t *ms); 00144 00158 APR_DECLARE(apr_status_t) 00159 apr_memcache_server_create(apr_pool_t *p, 00160 const char *host, 00161 apr_port_t port, 00162 apr_uint32_t min, 00163 apr_uint32_t smax, 00164 apr_uint32_t max, 00165 apr_uint32_t ttl, 00166 apr_memcache_server_t **ns); 00174 APR_DECLARE(apr_status_t) 00175 apr_memcache_create(apr_pool_t *p, 00176 apr_uint16_t max_servers, 00177 apr_uint32_t flags, 00178 apr_memcache_t **mc); 00179 00190 APR_DECLARE(apr_status_t) 00191 apr_memcache_getp(apr_memcache_t *mc, 00192 apr_pool_t *p, 00193 const char* key, 00194 char **baton, 00195 apr_size_t *len, 00196 apr_uint32_t *flags); 00197 00207 APR_DECLARE(apr_status_t) 00208 apr_memcache_set(apr_memcache_t *mc, 00209 const char* key, 00210 char *baton, 00211 const apr_uint32_t data_size, 00212 apr_uint32_t timeout, 00213 apr_uint32_t flags); 00214 00226 APR_DECLARE(apr_status_t) 00227 apr_memcache_add(apr_memcache_t *mc, 00228 const char* key, 00229 char *baton, 00230 const apr_uint32_t data_size, 00231 apr_uint32_t timeout, 00232 apr_uint32_t flags); 00233 00245 APR_DECLARE(apr_status_t) 00246 apr_memcache_replace(apr_memcache_t *mc, 00247 const char* key, 00248 char *data, 00249 const apr_uint32_t data_size, 00250 apr_uint32_t timeout, 00251 apr_uint32_t flags); 00258 APR_DECLARE(apr_status_t) 00259 apr_memcache_delete(apr_memcache_t *mc, 00260 const char* key, 00261 apr_uint32_t timeout); 00262 00270 APR_DECLARE(apr_status_t) 00271 apr_memcache_incr(apr_memcache_t *mc, 00272 const char* key, 00273 apr_int32_t n, 00274 apr_uint32_t *nv); 00275 00283 APR_DECLARE(apr_status_t) 00284 apr_memcache_decr(apr_memcache_t *mc, 00285 const char* key, 00286 apr_int32_t n, 00287 apr_uint32_t *new_value); 00288 00296 APR_DECLARE(apr_status_t) 00297 apr_memcache_version(apr_memcache_server_t *ms, 00298 apr_pool_t *p, 00299 char **baton); 00300 00301 typedef struct 00302 { 00304 const char* version; 00306 apr_uint32_t pid; 00308 apr_uint32_t uptime; 00310 apr_time_t time; 00312 apr_time_t rusage_user; 00314 apr_time_t rusage_system; 00316 apr_uint32_t curr_items; 00318 apr_uint32_t total_items; 00320 apr_uint64_t bytes; 00322 apr_uint32_t curr_connections; 00324 apr_uint32_t total_connections; 00326 apr_uint32_t connection_structures; 00328 apr_uint32_t cmd_get; 00330 apr_uint32_t cmd_set; 00332 apr_uint32_t get_hits; 00334 apr_uint32_t get_misses; 00336 apr_uint64_t bytes_read; 00338 apr_uint64_t bytes_written; 00340 apr_uint32_t limit_maxbytes; 00341 } apr_memcache_stats_t; 00342 00349 APR_DECLARE(apr_status_t) 00350 apr_memcache_stats(apr_memcache_server_t *ms, 00351 apr_pool_t *p, 00352 apr_memcache_stats_t **stats); 00353 00354 00357 #ifdef __cplusplus 00358 } 00359 #endif 00360 00361 #endif /* APR_MEMCACHE_H */

Generated on Fri Dec 10 15:07:10 2004 for apr_memcache by doxygen 1.3.7