Tie::DB_FileLockLocking access to Berkeley DB 1.x | |
Download |
Tie::DB_FileLock Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- John M Vinopal
- Publisher web site:
- http://search.cpan.org/~jmv/
Tie::DB_FileLock Tags
Tie::DB_FileLock Description
Locking access to Berkeley DB 1.x Tie::DB_FileLock is a Perl module that offers locking access to Berkeley DB 1.x.SYNOPSIS use Tie::DB_FileLock; tie %hash, 'Tie::DB_FileLock', ; tie %hash, 'Tie::DB_FileLock', $file, $flags, $mode, $DB_BTREE; $X->debug($value); $status = $X->del($key ); $status = $X->put($key, $value ); $status = $X->get($key, $value ); $status = $X->seq($key, $value, $flags); $status = $X->sync(); $status = $X->fd(); # BTREE only $count = $X->get_dup($key); @list = $X->get_dup($key); %list = $X->get_dup($key, 1); $status = $X->find_dup($key, $value); $status = $X->del_dup($key, $value); # DBM Filters $old_filter = $db->filter_store_key ( sub { ... } ); $old_filter = $db->filter_store_value( sub { ... } ); $old_filter = $db->filter_fetch_key ( sub { ... } ); $old_filter = $db->filter_fetch_value( sub { ... } ); untie %hash;Module DB_File allows perl to tie hashes to on-disk dbm files, but fails to provide any method by which the hashes might be locked, providing exclusive access or preventing page-level collisions. Tie::DB_FileLock extends DB_File, providing a locking layer using flock().Unlike Tie::DB_Lock, Tie::DB_FileLock does not duplicate files to allow concurrent access for readers and writers. Tie::DB_FileLock is therefore suitable for large dbms with relatively short locking periods.Tie::DB_FileLock is designed as a drop-in replacement for DB_File, requiring minimal code changes. Change all occurrences of "DB_File" to "Tie::DB_FileLock" and all should be well. DB_RECNO is not presently supported by Tie::DB_FileLock.Arguments to Tie::DB_FileLock are identical as those to DB_File. The dbm is locked for shared access if opened RO, exclusively otherwise. The default, as in DB_File, is read/write/create.Use of the predefined references $DB_HASH, $DB_BTREE, and $DB_RECNO, is identical as with DB_File. When creating your own, the new call is the same, but the object created is a DB_File::XXX thing and not a Tie::DB_FileLock::XXX thing -- therefore error messages will refer to DB_File::XXX. Requirements: · Perl
Tie::DB_FileLock Related Software