I am currently using Storables lock_store and lock_retrieve to maintain
a persistent data structure.  I use a session_id as a key and each data
structure has a last modified time that I use to expire it.  I was under
the impression that these two functions would be safe for concurrent
access, but I seem to be getting 'bad hashes' returned after there is an
attempt at concurrent access to the storable file.  Any pointers would
be appreciated.  Below is a simplified example of what I am doing.

my $hr=lock_retrieve("my_file");
for(keys %{$hr}){
    delete $hr->{$_} if ($hr->{$_}->{time} < time- $session_length)
}
# do stuff here
$hr->{sid}->{other_stuff}=$whatever;

# restore file
lock_store($hr,"my_file");

P.S. Thanks to all who contribute regularly on this list.  I find it
most enlightening

Reply via email to