Cache::Swifty - A Perl frontend for the Swifty cache engine
use Cache::Swifty; my $cache = Cache::Swifty->new({ dir => 'path_to_cache_dir', }); $cache->set('key', 'value'); my $value = $cache->get('key');
Cache::Swifty is a perl frontend for the Swifty cache engine. For more information, please refer to http://labs.cybozu.co.jp/blog/kazuhoatwork/swifty/.
Cache::Swifty
The following parameters are recognized by the new function.
new
Required. Cache directory to be used. The directory must be initialized prior to calling the method by using the swifty command line tool.
Optional. Reference to a hash function taking a scalar and its length as arguments. If omitted, Cache::Swifty will use its internal adler32 function for hash calculation.
Optional. Lifetime of cached entries in seconds. Defaults to 3600 if omitted.
Optional.
Cache::Swifty supports following flags. The flags can be set at initialization by using the constructor. It is also possible to adjust the flags laterwards by calling the flags accessor.
flags
Flag to activate / disactivate internal checksum for data integrity.
Returns cached value or undef if not found.
Sets given key,value pair. Only scalar variables can be stored.
Accessor for default lifetime.
Accessor for the forwarded refresh notifier (set in seconds).
Returns if the entry should be refreshed.
Accessor for flags.
Returns error code of swifty.
The default hash function.
http://labs.cybozu.co.jp/blog/kazuhoatwork/swify/
Copyright (c) 2007 Cybozu Labs, Inc. All rights reserved.
written by Kazuho Oku <kazuhooku@gmail.com>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Cache::Swifty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cache::Swifty
CPAN shell
perl -MCPAN -e shell install Cache::Swifty
For more information on module installation, please visit the detailed CPAN module installation guide.