-
Couldn't load subscription status.
- Fork 186
Caching
Steven Davidovitz edited this page May 13, 2013
·
1 revision
ETags are handled automatically by a memory-backed LRU cache. By default, it will handle up to 1000 GET/HEAD requests.
You may change the cache by setting the option during configuration.
For example, if you would like to use the same cache as your Rails application:
config.cache = Rails.cacheAny methods on ZendeskAPI::Client that return a collection (e.g. "tickets", "search", ...) are cached based on the parameters passed.
For example:
client.search(:query => "test") # => #<ZendeskAPI::Collection:object_id=1>
client.search(:query => "hello") # => #<ZendeskAPI::Collection:object_id=2>
client.search(:query => "test") # => #<ZendeskAPI::Collection:object_id=1> (same as first call)To override the cache and return a new instance, pass the :reload option:
client.search(:query => "test") # => #<ZendeskAPI::Collection:object_id=1>
client.search(:query => "test", :reload => true) # => #<ZendeskAPI::Collection:object_id=2>
Collections also implement their own limited caching.