Elastic::Model::Results::Cached - A cacheable iterator over bounded/finite search results
$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 );
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.
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.
The cache_key is a canonical JSON string representation of the full "search" in Elastic::Model::Role::Results parameter.
Clinton Gormley <firstname.lastname@example.org>
This software is copyright (c) 2014 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.