Module: JSONCache
Overview
JSONCache is a simple interface to cache JSON based API calls
Instance Method Summary collapse
-
#cache(key, options = {}) ⇒ Object
Retrieves cached data for the specified key and caches the data provided if the cache isn’t valid.
Instance Method Details
#cache(key, options = {}) ⇒ Object
Retrieves cached data for the specified key and caches the data provided if the cache isn’t valid. Accepted options parameters
> [Boolean] symbolize
> [String] cache_directory
> [Fixnum] delta
15 16 17 18 19 20 |
# File 'lib/jsoncache.rb', line 15 def cache(key, = {}) return retrieve_cache(key, ) if cached?(key, ) result = yield cache_file(key, result, ) result end |