Module: Workarea::Elasticsearch::QueryCache::Client
- Defined in:
- lib/workarea/elasticsearch/query_cache.rb
Instance Method Summary collapse
-
#perform_request(method, path, params = {}, body = nil) ⇒ Object
bypass unless cache enabled.
Instance Method Details
#perform_request(method, path, params = {}, body = nil) ⇒ Object
bypass unless cache enabled
if post, clear cache and super else fetch or perform and store
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/workarea/elasticsearch/query_cache.rb', line 110 def perform_request(method, path, params={}, body=nil) return super unless QueryCache.enabled? method = @send_get_body_as if 'GET' == method && body if method == 'GET' cache_key = [method, path, params, body] unless response = QueryCache.cache_table[cache_key] response = transport.perform_request method, path, params, body QueryCache.cache_table[cache_key] = response end response else QueryCache.clear_cache transport.perform_request method, path, params, body end end |