Cache-Memcached-Managed

 view release on metacpan or  search on metacpan

lib/Cache/Memcached/Managed.pm  view on Meta::CPAN

#  IN: 1 instantiated object
#      2..N parameter hash
# OUT: 1 true if successful

sub add { shift->_do( 'add',@_ ) } #add

#---------------------------------------------------------------------------
# dead
#
# Cycles through all of the available memcached servers and checks whether
# they are alive or not.  Returns all of the memcached servers that seem to
# be inactive.
#
#  IN: 1 instantiated object
#      2 timeout to apply (default: 10 seconds)
# OUT: 1..N memcached servers that did not reply (in time)
#
#  or:
#
# OUT: 1 hash ref with dead servers

lib/Cache/Memcached/Managed.pm  view on Meta::CPAN


Counters are automagically created with L<incr> if they don't exist yet.

=head2 instant invalidation

Support for the new "flush_all" memcached action to invalidate all data in
a cache in one fell swoop.

=head2 dead memcached server detection

An easy way to check whether all related memcached servers are still alive.

=head2 starting/stopping memcached servers

Easy start / stop of indicated memcached servers, mainly intended for
development and testing environments.

=head2 extensive test-suite

An extensive test-suite is included (which is sadly lacking in the
Cache::Memcached distribution).

t/001basic.t  view on Meta::CPAN

foreach my $reset ( 0 .. 1 ) {

    # Check the backend servers
    my @server = $cache->servers;
    is_deeply( \@server, [$config],
      "Check if all memcached backend servers accounted for from a list" );
    my $servers = $cache->servers;
    is_deeply( $servers, { $config => undef },
      "Check if all memcached backend servers accounted for from a hash ref" );

    # Check whether backend servers all alive
    my @dead = $cache->dead;
    is( scalar @dead, 0, "Check that all servers are alive from a list" );
    my $dead = $cache->dead;
    is_deeply( $dead, {}, "Check that all servers are alive from a hash ref" );

    # Check group names
    my @group_name = $cache->group_names;
    is_deeply( \@group_name, ['group'],
      "Check that all group names accounted for from a list" );
    my $group_names = $cache->group_names;
    is_deeply( $group_names, { group => undef },
      "Check that all group names accounted for from a hash ref" );

    # No key, no ID



( run in 1.656 second using v1.01-cache-2.11-cpan-df04353d9ac )