Module: BirdGrinder::Cacheable::Methods

Defined in:
lib/bird_grinder/cacheable.rb

Instance Method Summary collapse

Instance Method Details

#cache_get(key) ⇒ Object

Gets the value for the given key from the cache store if the cache store is set.

Parameters:

  • key (Symbol)

    the key to get the value for

Returns:

  • (Object)

    the value for the given key

See Also:



47
48
49
50
# File 'lib/bird_grinder/cacheable.rb', line 47

def cache_get(key)
  cs = BirdGrinder.cache_store
  cs && cs[key.to_s]
end

#cache_set(key, value) ⇒ Object

Attempts to set the value for a given key in the current cache_store.

Parameters:

  • key (Symbol)

    the key to set the value for

  • value (Object)

    the value for said key

See Also:



58
59
60
61
# File 'lib/bird_grinder/cacheable.rb', line 58

def cache_set(key, value)
  cs = BirdGrinder.cache_store
  cs && cs[key.to_s] = value
end