| 10 | |
| 11 | * [http://miltonkeynes.pm.org/talks/2009/01/colin_bradford_memcached.pdf Memcached and Perl] (PDF) |
| 12 | {{{ |
| 13 | #!perl |
| 14 | use Cache::Memcached; |
| 15 | #Connect |
| 16 | my $cache = Cache::Memcached->new(servers => [ “10.0.0.1:11211”, |
| 17 | “10.0.0.2:11211” ]); |
| 18 | # Set some data - $data can be a ref, as long as Storable can nfreeze it |
| 19 | $cache->set($key, $data, 3600); # 1 hour expiry |
| 20 | # Get the data back |
| 21 | my $x = $cache->get($key); |
| 22 | # or get multiple pieces simultaneously |
| 23 | my $hashref = $cache->get_multi($key1, $key2, $key3); |
| 24 | }}} |