Module: CachedResource::Caching::ClassMethods
- Defined in:
- lib/cached_resource/caching.rb
Instance Method Summary collapse
-
#clear_cache ⇒ Object
Clear the cache.
-
#find_with_cache(*arguments) ⇒ Object
Find a resource using the cache or resend the request if :reload is set to true or caching is disabled.
Instance Method Details
#clear_cache ⇒ Object
Clear the cache.
26 27 28 |
# File 'lib/cached_resource/caching.rb', line 26 def clear_cache cache_clear end |
#find_with_cache(*arguments) ⇒ Object
Find a resource using the cache or resend the request if :reload is set to true or caching is disabled.
16 17 18 19 20 21 22 23 |
# File 'lib/cached_resource/caching.rb', line 16 def find_with_cache(*arguments) arguments << {} unless arguments.last.is_a?(Hash) should_reload = arguments.last.delete(:reload) || !cached_resource.enabled arguments.pop if arguments.last.empty? key = cache_key(arguments) should_reload ? find_via_reload(key, *arguments) : find_via_cache(key, *arguments) end |