The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Zing::Repo - Generic Store

ABSTRACT

Generic Store Abstraction

SYNOPSIS

  use Zing::Repo;

  my $repo = Zing::Repo->new(name => 'repo');

  # $repo->recv('text-1');

DESCRIPTION

This package provides a general-purpose data storage abstraction.

LIBRARIES

This package uses type constraints from:

Zing::Types

ATTRIBUTES

This package has the following attributes:

name

  name(Str)

This attribute is read-only, accepts (Str) values, and is required.

server

  server(Server)

This attribute is read-only, accepts (Server) values, and is optional.

store

  store(Store)

This attribute is read-only, accepts (Store) values, and is optional.

target

  target(Enum[qw(global local)])

This attribute is read-only, accepts (Enum[qw(global local)]) values, and is optional.

METHODS

This package implements the following methods:

drop

  drop(Str @keys) : Int

The drop method returns truthy if the data was removed from the store.

drop example #1
  # given: synopsis

  $repo->drop('text-1');

ids

  ids() : ArrayRef[Str]

The ids method returns a list of IDs (keys) stored under the datastore namespace.

ids example #1
  # given: synopsis

  my $ids = $repo->ids;

keys

  keys() : ArrayRef[Str]

The keys method returns a list of fully-qualified keys stored under the datastore namespace.

keys example #1
  # given: synopsis

  my $keys = $repo->keys;

term

  term(Str @keys) : Str

The term method generates a term (safe string) for the datastore.

term example #1
  # given: synopsis

  my $term = $repo->term('text-1');

test

  test(Str @keys) : Int

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

test example #1
  # given: synopsis

  $repo->test('text-1');
test example #2
  # given: synopsis

  $repo->store->send($repo->term('text-1'), { test => time });

  $repo->test('text-1');

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