Class: Somecache::Custom

Inherits:
Object
  • Object
show all
Defined in:
lib/somecache/custom.rb

Instance Method Summary collapse

Constructor Details

#initialize(namespace:, cache:, **options) ⇒ Custom

Returns a new instance of Custom.

[View source]

3
4
5
6
7
# File 'lib/somecache/custom.rb', line 3

def initialize(namespace:, cache:, **options)
  @namespace = namespace
  @options = options
  @cache = cache
end

Instance Method Details

#delete(key) ⇒ Object

[View source]

21
22
23
# File 'lib/somecache/custom.rb', line 21

def delete(key)
  @cache.delete(key_with_namespace(key))
end

#fetch(key, &block) ⇒ Object

[View source]

9
10
11
# File 'lib/somecache/custom.rb', line 9

def fetch(key, &block)
  @cache.fetch(key_with_namespace(key), **@options, &block)
end

#read(key) ⇒ Object

[View source]

17
18
19
# File 'lib/somecache/custom.rb', line 17

def read(key)
  @cache.read(key_with_namespace(key), **@options)
end

#write(key, value) ⇒ Object

[View source]

13
14
15
# File 'lib/somecache/custom.rb', line 13

def write(key, value)
  @cache.write(key_with_namespace(key), value, **@options)
end