Author image Tomohiro Teranishi
and 1 contributors

NAME

Cache::Funky::Storage::Memcached - Cache::Funky Memcached Storage.

DESCRIPTION

Memcached Storage for Cache::Funky

SYNOPSIS

  package MyCache;
  
  use strict;
  use Cache::Memcached;
  use base qw/Cache::Funky/;
  
  __PACKAGE__->setup('Storage::Memcached' => { servers => [ '127.0.0.1:12345' ] });
  __PACKAGE__->register( 'foo', sub { time } );
  __PACKAGE__->register( 'boo', sub { shift . '_' . `date` } ); # * date: $id + _Tue May 1 21:53:36 JST 2007
  
  1;

run.pl

  #!/usr/bin/perl
  
  use strict;
  use MyCache;
  use Perl6::Say;
  
  say ( MyCache->foo() );
  sleep(3);
  say ( MyCache->foo() );
  
  MyCache->delete('foo');
  say ( MyCache->foo() );

  say ( MyCache->boo('id1') );
  say ( MyCache->boo('id2') );
    
  sleep 10;
  say ( MyCache->boo('id1') );
    
  # only remove id1
  MyCache->delete('boo', 'id1');

  say ( MyCache->boo('id1') );
  say ( MyCache->boo('id2') );

  MyCache->deletes([qw/foo boo/]);

METHOD

new

set

get

delete

SEE ALSO

Cache::Funky

AUTHOR

Tomohiro Teranishi <tomohiro.teranishi@gmail.com>

COPYRIGHT AND LICENSE

Copyright (c) Tomohiro Teranishi, All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.