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

Object::Store - abstract class to store, modify, delete and search Perl objects

METHODS

$store = Object::Store->new (backend => $store_backend).

Instantiates a new Object::Store object using backend $store_backend.

$store_backend must implement the set(), get(), del() and list() methods. It can also optionally implement the find() method, otherwise the default find() is used.

$store->set ($object_id => $object);

Inserts or update an object.

$store->get ($class, $object_id);

Returns an object.

$storage->del ($class, $object_id);

Removes an object.

$storage->list ($class);

Returns a list of object IDs.

$storage->find (%args);

Generic 'search for stuff' method.

If $store_backend->find() exists, calls $store_backend->find(%args)

Otherwise, it creates a list of objects using list() and get() and performs the search on the object list, assuming objects are hash references. The default syntax for %args is

  foo => "<operand><value>",
  bar => "<operand><value>",
  etc.

Where <operand> is eq:, ne:, le:, lt:, gt:, ge:, gt:, ==:, >=:, >:, <=:, <: same behavior as Perl equivalent comparators.

You can also use like:, which behaves like SQL LIKE statements where % matches any substring and _ matches any character.

You can also use regexp: and use a Perl regexp.

If no valid operand is used, it assumes eq:.

Returns a list of matching objects.