NAME
Data::AnyXfer::Elastic::Cache
SYNOPSIS
my
$cache
= Data::AnyXfer::Elastic::Cache->new(
index_info
=> IndexInfo->new );
my
$data
=
$cache
->get_or_set(
id
=> 12345,
callback
=>
sub
{ {
# document } },
);
DESCRIPTION
Data::AnyXfer::Elastic::Cache is a way of using Elasticsearch like memcache.
ATTRIBUTES
METHODS
get_or_set
A short cut for calling get()
and then set()
if no value found.
get
$cache
->get(
id
=> 12345 );
Returns document with id or undef if not found. Accepts the same parameters as www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html
set
$cache
->set(
id
=> 12345,
callback
=>
sub
{ some_method() }
);
Creates or replaces a document with the id. Callback function should return the document body. Accepts additional parameters documented in: www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
$cache
->
delete
(
id
=> 12345 );
Deletes document with id. Note that deletes are not instantaneous. Accepts additional parameters documented in: www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html
COPYRIGHT
This software is copyright (c) 2019, Anthony Lucas.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.