AnyEvent-KVStore

 view release on metacpan or  search on metacpan

lib/AnyEvent/KVStore/Hash.pm  view on Meta::CPAN

and disadvantages of just storing the data in a hash table, but comes with
callback features on write.  You can use this as a glorified enriched hashtable
or you can use other modules in this framework to connect to shared key/value
stores.

Each kvstore here has its own keyspace and watch list.

=head2 Watch Behavior

C<AnyEvent::KVStore::Hash> allows for unlimited watches to be set up, and
because this key/value store is private, the callbacks are handled synchronous
to the writes.  If you want asynchronous callbacks, you can use the
C<unblock_sub> function from L<Coro>.

Watches are currently indexed by the first letter of the prefix, or if no
prefix is given, an empty string.  Watches are then checked (and executed)
in order of:

=over

=item First empty prefix watches

lib/AnyEvent/KVStore/Hash.pm  view on Meta::CPAN

=head2 read

=head2 exists

=head2 list

=head2 write

=head2 watch

In this module, watches are run synchronously, not via AnyEvent's event loop.

If you wish to use AnyEvent's event loop, use condition variables with
callbacks set and C<send> them.

=cut

sub read($$) {
    my ($self, $key) = @_;
    return $self->_store->{$key};
}



( run in 0.237 second using v1.01-cache-2.11-cpan-0d8aa00de5b )