package CloudStore::memcache;

use Cache::Memcached;
use JSON::XS;

sub new {
	my ($class) = @_;
	my $server = new Cache::Memcached {
#		'servers' => [ "127.0.0.1:11211" ],
		'servers' => [ "127.0.0.1:11222" ],
		'debug' => 1,
	#	'compress_threshold' => 10_000,
	};
	#$server->set_servers($array_ref);
	#$server->set_compress_threshold(10_000);
	$server->enable_compress(0);

	my $self = { server => $server };
	bless $self, $class;

	return $self;
}

sub get {
	my ($self,$k) = @_;
	decode_json $self->{server}->get( $k );
}

sub set {
	my ($self,$k,$v) = @_;
	$self->{server}->set( $k => encode_json $v );
}

1;
