Clinton Gormley > Elastic-Model-0.27 > Elastic::Model::Results::Cached

Download:
Elastic-Model-0.27.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.27   Source   Latest Release: Elastic-Model-0.29_2-TRIAL

NAME ^

Elastic::Model::Results::Cached - A cacheable iterator over bounded/finite search results

VERSION ^

version 0.27

SYNOPSIS ^

    $cache   = CHI->new(...);
    $view    = $model->view
                     ->cache( $cache )
                     ->cache_opts( expires_in => '30 sec' );

    $results = $view->cached_search;
    $results = $view->cached_search( expires_in => '2 sec', force_set => 1 );

DESCRIPTION ^

An Elastic::Model::Results::Cached object is returned when you call "cached_search()" in Elastic::Model::View, and behaves exactly the same as Elastic::Model::Results except that it will try to retrieve the results from the cache, before hitting Elasticsearch.

ADDITIONAL ATTRIBUTES ^

cache

The CHI-compatible cache object from "cache" in Elastic::Model::View.

cache_opts

The combination of the default "cache_opts" in Elastic::Model::View plus any additional options passed in to "cached_search()" in Elastic::Model::View. These options are passed to CHI's get() or set() methods.

cache_key

The cache_key is a canonical JSON string representation of the full "search" in Elastic::Model::Role::Results parameter.

AUTHOR ^

Clinton Gormley <drtech@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Clinton Gormley.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: