NAME
Cache::Memcached::LibMemcached - Perl Interface to libmemcached
SYNOPSIS
use Cache::Memcached::LibMemcached;
my $memd = Cache::Memcached::LibMemcached->new({
serves => [ "10.0.0.15:11211", "10.0.0.15:11212", "/var/sock/memcached" ],
compress_threshold => 10_000
});
$memd->set("my_key", "Some value");
$memd->set("object_key", { 'complex' => [ "object", 2, 4 ]});
$val = $memd->get("my_key");
$val = $memd->get("object_key");
if ($val) { print $val->{complex}->[2] }
DESCRIPTION
This is the Perl Interface to libmemcached, a C library to interface with memcached.
There's also a Memcached::libmemcached available on googlecode, but the intent of Cache::Memcached::LibMemcached is to provide users with consistent API as Cache::Memcached.
METHODS
new
Takes on parameter, a hashref of options.
set_servers
Sets the server list. Note that currently you should not expect this to replace the server list that Cache::Memcached::LibMemcached works -- instead it ADDS to the list. Normally you shouldn't call this method directly, because it's called by new().
This behavior *may* change in later releases.
get
my $val = $memd->get($key);
Retrieves a key from the memcached. Returns the value (automatically thawed with Storable, if necessary) or undef.
Currently the arrayref form of $key is NOT supported. Perhaps in the future.
set
$memd->set($key, $value[, $expires]);
Unconditionally sets a key to a given value in the memcache. Returns true if it was stored successfully.
Currently the arrayref form of $key is NOT supported. Perhaps in the future.
CONSTANTS
MEMCACHED_CLIENT_ERROR
MEMCACHED_CONNECTION_BIND_FAILURE
MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE
MEMCACHED_DATA_DOES_NOT_EXIST
MEMCACHED_DATA_EXISTS
MEMCACHED_DELETED
MEMCACHED_END
MEMCACHED_ERRNO
MEMCACHED_FAILURE
MEMCACHED_FAIL_UNIX_SOCKET
MEMCACHED_FETCH_NOTFINISHED
MEMCACHED_HOST_LOOKUP_FAILURE
MEMCACHED_MAXIMUM_RETURN
MEMCACHED_MEMORY_ALLOCATION_FAILURE
MEMCACHED_NOTFOUND
MEMCACHED_NOTSTORED
MEMCACHED_NOT_SUPPORTED
MEMCACHED_NO_KEY_PROVIDED
MEMCACHED_NO_SERVERS
MEMCACHED_PARTIAL_READ
MEMCACHED_PROTOCOL_ERROR
MEMCACHED_READ_FAILURE
MEMCACHED_SERVER_ERROR
MEMCACHED_SOME_ERRORS
MEMCACHED_STAT
MEMCACHED_STORED
MEMCACHED_SUCCESS
MEMCACHED_TIMEOUT
MEMCACHED_UNKNOWN_READ_FAILURE
MEMCACHED_VALUE
MEMCACHED_WRITE_FAILURE
F_STORABLE
For internal use. Indicates the value was serialized via Storable.
F_COMPRESS
For internal use. Indicates the value was compressed via Compress::Zlib.
AUTHOR
Copyright (c) 2008 Daisuke Maki <daisuke@endeworks.jp>
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html