The Perl Advent Calendar needs more articles for 2022. Submit your idea today!

NAME

Zing::Store::Redis - Redis Storage

ABSTRACT

Redis Storage Abstraction

SYNOPSIS

use Zing::Store::Redis;
use Zing::Encoder::Dump;

my $redis = Zing::Store::Redis->new(
  encoder => Zing::Encoder::Dump->new
);

# $redis->drop;

DESCRIPTION

This package provides a Redis storage adapter for use with data persistence abstractions.

INHERITS

This package inherits behaviors from:

Zing::Store

LIBRARIES

This package uses type constraints from:

Zing::Types

ATTRIBUTES

This package has the following attributes:

client

client(InstanceOf["Redis"])

This attribute is read-only, accepts (InstanceOf["Redis"]) values, and is optional.

METHODS

This package implements the following methods:

decode

decode(Str $data) : HashRef

The decode method decodes the JSON data provided and returns the data as a hashref.

drop

drop(Str $key) : Int

The drop method removes (drops) the item from the datastore.

encode

encode(HashRef $data) : Str

The encode method encodes and returns the data provided as JSON.

keys

keys(Str @keys) : ArrayRef[Str]

The keys method returns a list of keys under the namespace of the datastore or provided key.

lpull

lpull(Str $key) : Maybe[HashRef]

The lpull method pops data off of the top of a list in the datastore.

lpush

lpush(Str $key, HashRef $val) : Int

The lpush method pushed data onto the top of a list in the datastore.

recv

recv(Str $key) : Maybe[HashRef]

The recv method fetches and returns data from the datastore by its key.

rpull

rpull(Str $key) : Maybe[HashRef]

The rpull method pops data off of the bottom of a list in the datastore.

rpush

rpush(Str $key, HashRef $val) : Int

The rpush method pushed data onto the bottom of a list in the datastore.

send

send(Str $key, HashRef $val) : Str

The send method commits data to the datastore with its key and returns truthy.

size

size(Str $key) : Int

The size method returns the size of a list in the datastore.

slot

slot(Str $key, Int $pos) : Maybe[HashRef]

The slot method returns the data from a list in the datastore by its index.

test

test(Str $key) : Int

The test method returns truthy if the specific key (or datastore) exists.

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

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".

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues