# Localmemcache-0.4.0: A persistent key-value database based on mmap()'ed shared memory

**URL:** <https://www.ruby-forum.com/t/localmemcache-0-4-0-a-persistent-key-value-database-based-on-mmap-ed-shared-memory/167290>\
**Category:** Ruby\
**Created:** [May 6, 2009, 1:09pm UTC](https://www.ruby-forum.com/t/localmemcache-0-4-0-a-persistent-key-value-database-based-on-mmap-ed-shared-memory/167290 "2009-05-06T13:09:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sven\_CSKoehler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3be4f8/32.png) [@Sven\_CSKoehler](https://www.ruby-forum.com/u/Sven_CSKoehler)\
**Post date:** [May 6, 2009, 1:09pm UTC](https://www.ruby-forum.com/t/localmemcache-0-4-0-a-persistent-key-value-database-based-on-mmap-ed-shared-memory/167290/1 "2009-05-06T13:09:31Z")

</div>

Hi,

I am happy to release localmemcache 0.4.0 today. This version mainly  
aims to make the API more complete and less confusing to users (thanks  
for your feedback!). The version jump is mostly because of  
incompatible API changes and that some of the adjustments required the  
the database format to change which means that old .lmc files cannot be  
read by 0.4.0.

# API CHANGES

- New class for storing Ruby objects directly instead of just strings:  
LocalMemCache::SharedObjectStorage

- New instance methods: .clear() [clear/empty hashtable], .size(),  
.each\_pair(), .random\_pair()

Cleanups:

- LocalMemCache’s class methods .clear() and .clear\_namespace() have  
been renamed to .drop(). The :repair parameter is now called  
:force.
- LocalMemCache.check\_namespace() has been removed (use .check()  
instead).

- [http://localmemcache.rubyforge.org/](http://localmemcache.rubyforge.org/)

# EXAMPLE

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[:foo] = 1  
$lm[:foo]  
$lm.delete(:foo)

# INSTALL

# gem install localmemcache

(In case rubyforge has not yet updated the mirrors, fetch the 0.3.0 gem  
from here: [http://github.com/sck/localmemcache/downloads](http://github.com/sck/localmemcache/downloads) and then do

# gem install localmemcache-0.4.0.gem )

# CONTACT

Please contact me with bugs, suggestions and patches at: schween + snafu

# de

# LINKS

Localmemcache: [http://localmemcache.rubyforge.org/](http://localmemcache.rubyforge.org/)  
Rubyforge project: [http://localmemcache.rubyforge.org/](http://localmemcache.rubyforge.org/)

Source code is hosted on github: [GitHub - sck/localmemcache: mmap -\> lmc\_valloc -\> hashtable. BAM database](http://github.com/sck/localmemcache/)

Best,

Sven C. Koehler

4523cedca8e3ba8d5b51e611f0b24431 localmemcache-0.4.0.gem  
c8d4be984ae5d115ef6e4deed40e7ea9 localmemcache-0.4.0.tar.gz
