agentzh / mod-libmemcached-cache

libmemcached-based cache storage module for Apache2's mod_cache

This URL has Read+Write access

name age message
file .deps Sat Aug 15 05:08:25 -0700 2009 use apache's build system in our makefile [agentzh]
file .gitignore Sat Feb 28 02:19:17 -0800 2009 updated .gitignore [agentzh]
file LICENSE Tue Feb 24 18:38:58 -0800 2009 updated LICENSE [agentzh]
file Makefile Loading commit data...
file README Sat Aug 15 05:12:02 -0700 2009 updated README to reflect makefile changes [agentzh]
file mod_libmemcached_cache.c Sun May 03 04:43:33 -0700 2009 more detailed error mesasges [agentzh]
file mod_libmemcached_cache.h
file modules.mk
README
mod_libmemcached_cache - A memcached storage backend based on libmemcached for mod_cache

To build this Apache 2.x module, you need to install libmemcached first:

Download the latest version of libmemcached tarball from below:

   http://tangent.org/553/default.html

Say, that we have libmemcached-0.26.tar.gz downloaded, use the following commands to build and install it to 
/opt/libmemcached or somewhere else:

    tar xzvf libmemcached-0.26.tar.gz
    cd libmemcached-0.26/
    ./configure --prefix=/opt/libmemcached
    make -j2
    sudo make install

And you'll also need the Apache source tree since Apache does not install mod_cache.h into the target directory but this 
module needs it.

To build this module, just type one command:

    make MOD_CACHE_SRC_DIR=/path/to/httpd-2.x.x/modules/cache \
        top_dir=/opt/apache2
        LIBMEMCACHED=/opt/libmemcached

where we assumed you install libmemcached to /opt/libmemcached and apache2 to /opt/apache2. If it's not the case, just 
change the paths correspondingly.

To install:

    make MOD_CACHE_SRC_DIR=/path/to/httpd-2.x.x/modules/cache \
        top_dir=/opt/apache2
        LIBMEMCACHED=/opt/libmemcached install

You can also specify a DESTDIR=/some/where in the command above for RPM/Debian packaging purposes.

Sample httpd.conf configuration:

  # you don't need the following line if you've already had mod_cache static linked into your Apache build
  LoadModule cache_module modules/mod_cache.so

  LoadModule libmemcached_cache_module modules/mod_libmemcached_cache.so

  # Config of libmemcached_cache:
  CacheEnable libmemcached /
  LibmemCacheServers foo.com, bar.org:54321

Note that comma is required to seperate those memcached servers. Pure spaces won't work.

Some other configuration directives should also work but not tested yet:

  LibmemCacheMaxObjectSize 1048576
  LibmemCacheMinObjectSize 1
  LibmemCacheMaxStreamingBuffer 1048576

------------------------------------------------------------------------
Copyright (C) 2009 Yahoo! China EEEE Works, Alibaba Inc.

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.