Class: TMDb::NullCache

Inherits:
Object
  • Object
show all
Defined in:
lib/tmdb/null_cache.rb

Overview

Looks like a cache but doesn’t perform any caching. This helps us avoid checking for whether a cache is configured or not, as per the Null Object pattern: en.wikipedia.org/wiki/Null_Object_pattern.

Instance Method Summary collapse

Instance Method Details

#fetch(cache_key) ⇒ Object

Returns the value of the yielded block. Assumes that a block is passed; ActiveSupport::Cache::Store#fetch allows for no block but we don’t use this internally. Ignores cache_key because no caching is performed.



13
14
15
# File 'lib/tmdb/null_cache.rb', line 13

def fetch(cache_key)
  yield
end