Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
libmemcached-based cache storage module for Apache2's mod_cache
C
Branch: master

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, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.

Something went wrong with that request. Please try again.