Zing::Store - Storage Abstraction
Data Storage Abstraction
use Zing::Store; my $store = Zing::Store->new; # $store->drop;
This package provides a data persistence interface to be implemented by data storage abstractions.
This package inherits behaviors from:
Zing::Entity
This package uses type constraints from:
Zing::Types
This package has the following attributes:
encoder(Encoder)
This attribute is read-only, accepts (Encoder) values, and is optional.
(Encoder)
This package implements the following methods:
args(Str $env) : (Any)
The args method parses strings with key/value data (typically from an environment variable) meant to be used in object construction.
# given: synopsis [$store->args('port=0001,debug=0')]
# given: synopsis [$store->args('ports=0001|0002,debug=0')]
decode(Str $data) : HashRef
The decode method should decode the data provided and returns the data as a hashref.
# given: synopsis $store->decode('{ status => "ok" }'); # e.g. # $ENV{ZING_ENCODER} # Zing::Encoder::Dump
drop(Str $key) : Int
The drop method should remove items from the datastore by key.
# given: synopsis $store->drop('model');
encode(HashRef $data) : Str
The encode method should encode and return the data provided in a format suitable for the underlying storage mechanism.
# given: synopsis $store->encode({ status => 'ok' });
keys(Str @keys) : ArrayRef[Str]
The keys method should return a list of keys under the namespace provided including itself.
# given: synopsis my $keys = $store->keys('zing:main:global:model:temp');
lpull(Str $key) : Maybe[HashRef]
The lpull method should pop data off of the top of a list in the datastore.
# given: synopsis $store->lpull('zing:main:global:model:items');
lpush(Str $key) : Int
The lpush method should push data onto the top of a list in the datastore.
# given: synopsis # $store->rpush('zing:main:global:model:items', { status => '1' }); # $store->rpush('zing:main:global:model:items', { status => '2' }); $store->lpush('zing:main:global:model:items', { status => '0' });
recv(Str $key) : Maybe[HashRef]
The recv method should fetch and return data from the datastore by its key.
# given: synopsis $store->recv('zing:main:global:model:temp');
rpull(Str $key) : Maybe[HashRef]
The rpull method should pop data off of the bottom of a list in the datastore.
# given: synopsis $store->rpull('zing:main:global:model:items');
rpush(Str $key, HashRef $val) : Int
The rpush method should push data onto the bottom of a list in the datastore.
# given: synopsis $store->rpush('zing:main:global:model:items', { status => 'ok' });
send(Str $key, HashRef $val) : Str
The send method should commit data to the datastore with its key and return truthy (or falsy if not).
# given: synopsis $store->send('zing:main:global:model:temp', { status => 'ok' });
size(Str $key) : Int
The size method should return the size of a list in the datastore.
# given: synopsis my $size = $store->size('zing:main:global:model:items');
slot(Str $key, Int $pos) : Maybe[HashRef]
The slot method should return the data from a list in the datastore by its position in the list.
# given: synopsis my $model = $store->slot('zing:main:global:model:items', 0);
test(Str $key) : Int
The test method should return truthy if the specific key exists in the datastore.
# given: synopsis # $store->rpush('zing:main:global:model:items', { status => 'ok' }); $store->test('zing:main:global:model:items');
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install Zing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zing
CPAN shell
perl -MCPAN -e shell install Zing
For more information on module installation, please visit the detailed CPAN module installation guide.