The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

AnyEvent::KVStore - A pluggable key-value store API for AnyEvent

VERSION

Version 0.1.2

SYNOPSIS

    use AnyEvent::KVStore;

    my $foo = AnyEvent::KVStore->new(type => 'etcd', config => $config);
    my $val = $foo->read($key);
    $foo->write($key, $val2);

    $foo->watch($keyspace, \&process_vals);

DESCRIPTION

The AnyEventLLKVStore framework intends to be a simple, pluggable API for abstracting away the details of key-value store integratoins in event loop for the standard operations one is likely to experience in an event loop.

The idea is to make key-value stores reasonably pluggable for variou skinds of operations so that when one fails to scale in one scenario, another can be used and alaternatively, the same app can support several different stores.

The framework uses Moo (Minimalist Object Orientation) to procide the basic interface specifications, and modules providing drivers here are expected to use Moo for defining accessors, etc.

ACCESSORS/PROPERTIES

module

The name of the driver used.

config

This is the configuratoin to connect to the driver.

SUBROUTINES/METHODS

new($args or %args)

Returns a new kvstore object for use in your application. Note that the actual connection is lazy, and therefore is not even made until use. This uses standard Moo/Moose constructor syntax.

list($prefix)

List all keys starting with $prefix

Returns a list of strings.

exists($key)

Returns true if the key exists, false if it does not.

read($key)

Returns the value of the key.

write($key, $value)

Writes the key to the key value store.

watch($prefix, $callback)

Watch the keys starting with $prefix and for each such key, execute $callback with the arguments as ($key, $value)

WRITING YOUR OWN DRIVER

Your driver should consume the AnyEvent::KVStore::Driver role. It then needs to implement the required interfaces. See the AnyEvent::KVStore::Driver documentation for details.

AUTHOR

Chris Travers, <chris.travers at gmail.com>

BUGS

Please report any bugs or feature requests to bug-anyevent-kvstore at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-KVStore. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

MODULE VARIATION

A few properties may vary from one module to another. For example, most modules should support multiple watch runs concurrently, though it is possible that some might not. Different modules may require different configuration hash keys.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc AnyEvent::KVStore

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2023 by Chris Travers.

This is free software, licensed under:

  The (three-clause) BSD License