Skip to content

Instantly share code, notes, and snippets.

@oogatta
Created December 21, 2012 06:18
Show Gist options
  • Save oogatta/4351001 to your computer and use it in GitHub Desktop.
Save oogatta/4351001 to your computer and use it in GitHub Desktop.
#! /usr/bin/env perl
use strict;
use warnings;
use Cache::Memcached::Fast;
use Data::Dumper;
my $memd = new Cache::Memcached::Fast({
servers => [ { address => 'localhost:11211', weight => 2.5 } ],
namespace => 'my:',
connect_timeout => 0.2,
io_timeout => 0.5,
close_on_error => 1,
compress_threshold => 100_000,
compress_ratio => 0.9,
compress_methods => [ \&IO::Compress::Gzip::gzip,
\&IO::Uncompress::Gunzip::gunzip ],
max_failures => 3,
failure_timeout => 2,
ketama_points => 150,
nowait => 1,
hash_namespace => 1,
serialize_methods => [ \&Storable::freeze, \&Storable::thaw ],
utf8 => ($^V ge v5.8.1 ? 1 : 0),
max_size => 512 * 1024,
});
$memd->set('scalar', 5);
$memd->set('hashref', { 'test' => 5, 'test2' => '5'});
print Dumper($memd->get('scalar'));
print Dumper($memd->get('hashref'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment