class Djin::MemoryCache

Public Class Methods

new(hash_store = {}) click to toggle source
# File lib/djin/memory_cache.rb, line 5
def initialize(hash_store = {})
  @hash_store = hash_store
end

Public Instance Methods

clear() click to toggle source
# File lib/djin/memory_cache.rb, line 13
def clear
  @hash_store = {}
end
fetch(key) { || ... } click to toggle source
# File lib/djin/memory_cache.rb, line 9
def fetch(key)
  @hash_store[key] || @hash_store[key] = yield
end