class Somecache::Custom
Public Class Methods
new(namespace:, cache:, **options)
click to toggle source
# File lib/somecache/custom.rb, line 3 def initialize(namespace:, cache:, **options) @namespace = namespace @options = options @cache = cache end
Public Instance Methods
delete(key)
click to toggle source
# File lib/somecache/custom.rb, line 21 def delete(key) @cache.delete(key_with_namespace(key)) end
fetch(key, &block)
click to toggle source
# File lib/somecache/custom.rb, line 9 def fetch(key, &block) @cache.fetch(key_with_namespace(key), **@options, &block) end
read(key)
click to toggle source
# File lib/somecache/custom.rb, line 17 def read(key) @cache.read(key_with_namespace(key), **@options) end
write(key, value)
click to toggle source
# File lib/somecache/custom.rb, line 13 def write(key, value) @cache.write(key_with_namespace(key), value, **@options) end
Private Instance Methods
key_with_namespace(key)
click to toggle source
# File lib/somecache/custom.rb, line 27 def key_with_namespace(key) "#{@namespace}/#{key}" end