Topic maps, memcached server backend
use TM::ResourceAble::MemCached; use Fcntl; # create/reset new map my $tm = new TM::ResourceAble::MemCached ( baseuri => 'http://whereever/', servers => [ localhost:11211 ], mode => O_TRUNC | O_CREAT, ); # use TM interface # open existing map my $tm = new TM::ResourceAble::MemCached ( baseuri => 'http://whereever/', servers => [ localhost:11211 ], );
This package implements \s-1TM\s0 using a memcached server farm as backend. You should be able (without much testing, mind you, so it is \s-1EXPERIMENTAL\s0) to perform all operations according to the \s-1TM\s0 interface.
\s-1NOTE\s0: The implementation is using the \s-1TIE\s0 technique (perltie via Tie::StdHash), so maybe there are problems lurking.
Of course, a set of memcacheds can store any number of maps. To keep them separate, the baseuri is used, so make sure every map gets its own baseuri.
The constructor expects a hash with the following keys:
The value must be a reference to an array of strings, each of the form host:port. If there is no such list, then the constructor will fail.
The value must be a value from Fcntl to control
whether the map should be created (\*(C`O_CREAT\*(C') when it does not exist, and/or
whether the map should be cleared (\*(C`O_TRUNC\*(C') when it existed before.
All other options are passed to the constructor chain of traits (TM::ResourceAble) and superclasses (\s-1TM\s0).
\s-1TM\s0, TM::ResourceAble
Copyright 2010, Robert Barta <[email protected]>, All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. http://www.perl.com/perl/misc/Artistic.html