Skip to content

Instantly share code, notes, and snippets.

@kacchan822
Created July 6, 2017 05:52
Show Gist options
  • Save kacchan822/bcdddcb2c44cf2602995445eb8bb6434 to your computer and use it in GitHub Desktop.
Save kacchan822/bcdddcb2c44cf2602995445eb8bb6434 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use Cache::Memcached;
my $memcached = Cache::Memcached->new({
servers => ["127.0.0.1:11211"]
});
print "Set (key, hoge) exptime:12sec\n";
$memcached->add('key', 'hoge', 12);
print $memcached->get('key'), "\n5sec sleeping...\n";
sleep 5;
print $memcached->get('key'), "\n5sec sleeping...\n";
sleep 5;
print $memcached->get('key'), "\n5sec sleeping...\n";
sleep 5;
print $memcached->get('key'), "<-- should be none value\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment