On Mon, 8 Jan 2001, Perrin Harkins wrote:

> On Mon, 8 Jan 2001, Sander van Zoest wrote:
> > > starters. A dbm would be fine too, but more trouble to purge old entries
> > > from.
> > You could always have a second dbm file that can keep track of TTL issues
> > of your data keys, so it would simply be a series of delete calls.
> > Granted you would have another DBM file to maintain.
> I find it kind of painful to trim dbm files, because most implementations
> don't relinquish disk space when you delete entries.  You end up having to
> actually make a new dbm file with the "good" contents copied over to it in
> order to slim it down.

Yeah, this is true. Some DBMs have special routines to fix these issues.  
You could use the gdbm_reorganize call to clean up those issues for 
example (if you are using gdbm that is)

Just some quick pseudo code (don't have a quick example ready here):

use GDBM_File;

my $gdbm = tie %hash, 'GDBM_File', 'file.gdbm' &GDBM_WRCREAT|&GDBM_FAST, 0640 
           or die "$!";

$gdbm->reorganize;

That definately helps a lot.

--
Sander van Zoest                                         [[EMAIL PROTECTED]]
Covalent Technologies, Inc.                           http://www.covalent.net/
(415) 536-5218                                 http://www.vanzoest.com/sander/

Reply via email to