Kazuho Oku > Cache-Swifty-0.07 > Cache::Swifty

Download:
Cache-Swifty-0.07.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.07   Source  

NAME ^

Cache::Swifty - A Perl frontend for the Swifty cache engine

SYNOPSIS ^

  use Cache::Swifty;
  
  my $cache = Cache::Swifty->new({
    dir => 'path_to_cache_dir',
  });
  
  $cache->set('key', 'value');
  my $value = $cache->get('key');

DESCRIPTION ^

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/.

THE CONSTRUCTOR ^

The following parameters are recognized by the new function.

dir

Required. Cache directory to be used. The directory must be initialized prior to calling the method by using the swifty command line tool.

hash_callback

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.

lifetime

Optional. Lifetime of cached entries in seconds. Defaults to 3600 if omitted.

refresh_before

Optional.

flags

Optional.

FLAGS ^

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_USE_CHECKSUM

Flag to activate / disactivate internal checksum for data integrity.

METHODS ^

get(key)

Returns cached value or undef if not found.

set(key, value[, expires])

Sets given key,value pair. Only scalar variables can be stored.

lifetime([ new_lifetime ])

Accessor for default lifetime.

refresh_before([ new_refresh_before ])

Accessor for the forwarded refresh notifier (set in seconds).

do_refresh()

Returns if the entry should be refreshed.

flags([ new_flags ])

Accessor for flags.

swifty_err()

Returns error code of swifty.

swifty_adler32(scalar)

The default hash function.

SEE ALSO ^

http://labs.cybozu.co.jp/blog/kazuhoatwork/swify/

AUTHOR ^

Copyright (c) 2007 Cybozu Labs, Inc. All rights reserved.

written by Kazuho Oku <kazuhooku@gmail.com>

LICENSE ^

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

syntax highlighting: