class Syro::Tilt::Cache::MemoryStore

A very thin wrapper around Hash, with a Mutex.

Public Class Methods

new() click to toggle source
# File lib/syro/tilt/cache.rb, line 10
def initialize
  @cache = {}
  @mutex = Mutex.new
end

Public Instance Methods

fetch(*key) { || ... } click to toggle source
# File lib/syro/tilt/cache.rb, line 15
def fetch(*key)
  @mutex.synchronize do
    @cache.fetch(key) do
      @cache[key] = yield
    end
  end
end