Class: Somecache::Custom
- Inherits:
-
Object
- Object
- Somecache::Custom
- Defined in:
- lib/somecache/custom.rb
Instance Method Summary collapse
- #delete(key) ⇒ Object
- #fetch(key, &block) ⇒ Object
-
#initialize(namespace:, cache:, **options) ⇒ Custom
constructor
A new instance of Custom.
- #read(key) ⇒ Object
- #write(key, value) ⇒ Object
Constructor Details
permalink #initialize(namespace:, cache:, **options) ⇒ Custom
Returns a new instance of Custom.
3 4 5 6 7 |
# File 'lib/somecache/custom.rb', line 3 def initialize(namespace:, cache:, **) @namespace = namespace @options = @cache = cache end |
Instance Method Details
permalink #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 |
permalink #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 |
permalink #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 |
permalink #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 |