跳至內容 跳至搜尋

本機快取儲存

簡單的記憶體備份快取。此快取並非執行緒安全,且僅用於作為單一執行緒的暫時記憶體快取。

方法
C
D
N
R
W

類別公開方法

new()

# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 36
def initialize
  @data = {}
end

執行個體公開方法

clear(options = nil)

# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 40
def clear(options = nil)
  @data.clear
end

delete_entry(key)

# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 57
def delete_entry(key)
  !!@data.delete(key)
end

read_entry(key)

# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 44
def read_entry(key)
  @data[key]
end

read_multi_entries(keys)

# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 48
def read_multi_entries(keys)
  @data.slice(*keys)
end

write_entry(key, entry)

# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 52
def write_entry(key, entry)
  @data[key] = entry
  true
end