We are using IPC::MM and it works great. We use it to 
cache about 5000 strings for our internationlized systems 
( EFIGS-J right now, going to 15 languages soon ). Its 
pretty easy, in our startup handler we have :

my $MM_SIZE = 5000000;
my $MM_FILE = 'st_cache_mm_file';
my $st_cache_mm = IPC::MM::mm_create($MM_SIZE, $MM_FILE);
my $st_cache_btree = 
IPC::MM::mm_make_btree_table($st_cache_mm);
tie %CACHE::mmcache, 'IPC::MM::BTree', $st_cache_btree;

Then we access it via the $CACHE::mmcache variable by 
language ID/Message ID hashes.

The performance is pretty good, a huge huge improvement 
over direct to database calls. The way we have it 
configured is that each child calls a function per string. 
This function checkes the apache wide MM cache, if it 
doesn't find it then it grabs it from the DB and sticks it 
there for the next child to come along. We were using 'per 
child' caching but it was slow, expensive and gave page 
load speeds with a lot of variance ( .5-1.5 seconds for 
cache, 10 seconds for uncachced ). It was pretty nasty.

We are not really expiring our cache, we just HUP apache 
to re-initialize it since MM is local to the root apache 
process.

Your mileage may vary, ours is pretty good.

John

On Sat, 05 Oct 2002 15:40:05 -0300
  Cristóvão Dalla Costa <[EMAIL PROTECTED]> wrote:
>Does anyone have experience with Apache::SharedMem? I'd 
>like to use it to store an in-perl cache of a few 
>thousand database items, in order to decrease load, but I 
>noticed that it's version 0.09 and not updated in a year, 
>so I became a little suspicious. Any comments?
>
>Thanks.
>

Reply via email to