#!/usr/bin/perl -w use strict; use Data::Dumper; use Benchmark qw(timethese); use Time::HiRes qw(gettimeofday); use Cache::Memcached; my $mc = Cache::Memcached->new({ servers => [qw(localhost:11211)], }); my $incr = 'incr'; $mc->set($incr, 1); timethese(-2, { incr => sub { $mc->incr($incr) }, }); $mc->set($incr, $mc->get($incr) * 2); timethese(-2, { decr => sub { $mc->decr($incr) }, }); my $key = 'key'; $mc->set($key, time); timethese(-2, { get => sub { $mc->get($key) }, }); timethese(-2, { set => sub { $mc->set(gettimeofday, 1) }, }); timethese(-2, { set_delete => sub { my $key = gettimeofday;$mc->set($key, 1);$mc->delete($key) }, }); $mc->delete($key);