Localmemcache README

A persistent key-value database based on mmap()‘ed shared memory.

WHAT IS IT?

Localmemcache is a library for C and ruby that aims to provide an interface similar to memcached but for accessing local data instead of remote data. It’s based on mmap()‘ed shared memory for maximum speed. Since version 0.3.0 it supports persistence, also making it a fast alternative to GDBM and Berkeley DB.

SUPPORTED SYSTEMS

  • a >=64bit Unix (32bit is possible but you’ll run out of virtual address space quickly)

  • a file system that offers sparse files

Note for OS X: OS X disqualifies as HFS+ doesn’t have sparse files and sem_timedwait() and sem_getvalue() aren’t supported as well.

Note for FreeBSD: It has been reported that Localmemcache sometimes hangs there, it is not yet clear what the problem is.

EXAMPLE

In Ruby:

require ‘localmemcache’ # 1. the memcached way # $lm = LocalMemCache.new :namespace => :viewcounters # 2. the GDBM way #$lm = LocalMemCache.new :filename => “./viewcounters.lmc” # 3. Using LocalMemCache::SharedObjectStorage $lm = LocalMemCache::SharedObjectStorage.new :filename => “./viewcounters.lmc” $lm = 1 $lm $lm.delete(:foo)

INSTALLATION

Ruby binding:

# gem install localmemcache

If you just want to use the C API, download the .tar.gz from:

rubyforge.org/frs/?group_id=7925