Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Data::Model::Driver::MUsercContributed Perl DData::Model::Driver::Memcached(3)

NAME
       Data::Model::Driver::Memcached -	storage	driver for memcached protocol

SYNOPSIS
	 package MyDB;
	 use base 'Data::Model';
	 use Data::Model::Schema;
	 use Data::Model::Driver::Memcached;

	 my $dbi_connect_options = {};
	 my $driver = Data::Model::Driver::Memcached->new(
	     memcached => Cache::Memcached::Fast->new({	servers	=> [ { address => "localhost:11211" }, ], }),
	 );

	 base_driver $driver;
	 install_model model_name => schema {
	   ....
	 };

DESCRIPTION
       Storage is used via a memcached protocol.

       It can save at memcached, Tokyo Tyrant, kai, groonga, etc.

OPTIONS
   serializer
	 my $driver = Data::Model::Driver::Memcached->new(
	     memcached	=> Cache::Memcached::Fast->new({ servers => [ {	address	=> "localhost:11211" },	], }),
	     serializer	=> 'Default', #	default	is L<Data::MessagePack>	or messagepack minimum set for Data::Model
	 );

       you can use customizable	serializer.

	 {
	     package MySerializer;
	     sub serialize {
		 my($class, $c,	$hash) = @_;
		 # you serialize of $hash
		 return	$serialize_string;
	     }
	     sub deserialize {
		 my($class, $c,	$serialize_string) = @_;
		 ...
		 return	$hash;
	     }
	 }
	 my $driver = Data::Model::Driver::Memcached->new(
	     memcached	=> Cache::Memcached::Fast->new({ servers => [ {	address	=> "localhost:11211" },	], }),
	     serializer	=> '+MySerializer',
	 );

   strip_keys
       strip tables key	data, Because key data stored in a memcached key part.

	 my $driver = Data::Model::Driver::Memcached->new(
	     memcached	=> Cache::Memcached::Fast->new({ servers => [ {	address	=> "localhost:11211" },	], }),
	     strip_keys	=> 1,
	 );

   ignore_undef_value
       When value is undef, a value is not put into storage.

       It becomes size saving at the time of obvious empty data.

	 my $driver = Data::Model::Driver::Memcached->new(
	     memcached		=> Cache::Memcached::Fast->new({ servers => [ {	address	=> "localhost:11211" },	], }),
	     ignore_undef_value	=> 1,
	 );

   model_name_realname column_name_rename
       compress	your table name	and column name.

OPTIONS	EXAMPLE
	 my $driver = Data::Model::Driver::Memcached->new(
	     memcached	=> Cache::Memcached::Fast->new({ servers => [ {	address	=> "localhost:11211" },	], namespace =>	'test',	}),
	     serializer	=> 'Default',
	     strip_keys	=> 1,
	 );
	 install_model simple => schema	{
	     schema_options model_name_realname	=> 's';
	     key 'id';
	     column 'id';
	     column 'name';
	     column 'nickname';
	     schema_options column_name_rename => {
		 id	  => 1,
		 name	  => 2,
		 nickname => 3,
	     };
	 };

	 $model->set(
	     simple => 'keyvalue' => {
		 name	  => 'osawa',
		 nickname => 'yappo',
	     }
	 );
	 # same	code
	 $memcached->add(
	     'tests:keyvalue',
	     Data::MessagePack->pack({ 2 => 'osawa', 3 => 'yappo' }),
	 );

SEE ALSO
       Cache::Memcache::Fast, Data::Model

AUTHOR
       Kazuhiro	Osawa <yappo <at> shibuya <doet> pl>

LICENSE
       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

POD ERRORS
       Hey! The	above document had some	coding errors, which are explained
       below:

       Around line 543:
	   Non-ASCII character seen before =encoding in	'<doet>'. Assuming
	   UTF-8

perl v5.32.0			  2013-07-08 Data::Model::Driver::Memcached(3)

NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OPTIONS EXAMPLE | SEE ALSO | AUTHOR | LICENSE | POD ERRORS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Data::Model::Driver::Memcached&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help