Module: TwitterTweetBot::Cache::Caching

Included in:
ClientExt
Defined in:
lib/twitter_tweet_bot/cache/caching.rb

Instance Method Summary collapse

Instance Method Details

#cacheObject



4
5
6
# File 'lib/twitter_tweet_bot/cache/caching.rb', line 4

def cache
  config.cache
end

#with_cache(&block) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/twitter_tweet_bot/cache/caching.rb', line 8

def with_cache(&block)
  current_cache = read_cache
  result = block.call(current_cache)
  write_cache(current_cache, result)

  result
end