Hateburo: kazeburo hatenablog

SRE / 運用系小姑 / Goを書くPerl Monger

Cache::Memcached::Fast::Safe 0.04 was out. It has get_or_set()

I added get_or_set() to Cache::Memcached::Fast::Safe and released as ver. 0.04


I saw some people make a module that inherits Cache::Memcached::Fast::Safe only for adding get_or_set().

sample code

use Cache::Memcached::Fast::Safe;
my $memd = Cache::Memcached::Fast::Safe->new({
  servers => [..]
$memcached->get_or_set('key:'.$id,sub {


$memcached->get_or_set('key:'.$id,sub {
  my $val = MyDB->retrieve($id);
  return ($val, $expires)