• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

example/H12-Jul-2007-10570

m4/H12-Jul-2007-349310

src/H12-Jul-2007-300204

LICENSEH A D12-Jul-2007757 1612

Makefile.amH A D12-Jul-2007205 118

READMEH A D12-Jul-20072.1 KiB9060

autogen.shH A D12-Jul-20071.1 KiB6145

configure.acH A D12-Jul-20071.4 KiB5342

README

1mod_memcache
2--------------
3
4Audience:
5
6mod_memcache may be interesting to you if you are:
71) developing Apache modules, and
82) want to connect to one or more memcached server instances from those
9   modules, and
103) are using apr_memcache to do so, and
114) would like to use the same apr_memcache_t handle for those connections, and
125) don't feel like writing and rewriting/cutting/pasting the Apache
13   conf code to deal with it.
14
15Note that 'mod_memcache' is a pretty vague and improper name for this
16module, but thats what I'm calling it for now. That may change in
17the future because a) its too close to mod_mem_cache, which is
18completely different in purpose, and b) it doesn't reflect
19specifically enough the purpose of this module. So yeah.
20
21Note that this module is really only of interest to module developers
22as it provides nothing more than a convenient way to deal with an
23apr_memcache_t.
24
25--------------
26
27Installation:
28
29# install mod_memcache as a DSO into your Apache 2 directory
30
31# if you grabbed the source from svn ...
32% ./autogen.sh
33
34# then
35% ./configure --with-apxs=/path/to/apxs \
36              --with-apr-memcache=/path/to/apr/memcache
37% make
38% make install
39
40--------------
41
42Configuration:
43
44# in your httpd.conf ...
45
46# load the shared object
47LoadModule memcache_module modules/mod_memcache.so
48# configure one or more memcached servers to use
49MemcacheServer 10.0.1.1:11211 min=2 smax=4 max=5 ttl=60
50MemcacheServer 10.0.1.1:11212 min=2 smax=4 max=5 ttl=60
51
52--------------
53
54Usage:
55
56/* in mod_yourmodule.c */
57
58#include "mod_memcache.h"
59
60/* .. in some handler .. */
61
62apr_memcache_t *mc;
63apr_status_t rv;
64
65mc = ap_memcache_client(r->server);
66rv = apr_memcache_set(mc, "cow", "moo", sizeof("cow") - 1, 0, 0);
67
68/* ... etc., and/or ... */
69
70apr_memcache_t *mc;
71apr_status_t rv;
72apr_hash_t *servers;
73apr_hash_index_t *hi;
74
75servers = ap_memcace_serverhash(r->server);
76rv = apr_memcache_create(r->pool, 10, 0, &mc);
77
78for (hi = apr_hash_first(pconf, servers);
79     hi;
80     hi = apr_hash_next(hi)) {
81
82    apr_hash_this(hi, NULL, NULL, &val);
83    ms = (apr_memcache_server_t *)val;
84
85   rv = apr_memcache_add_server(mc, ms);
86}
87
88
89
90