Class: Memosa::Cache
- Inherits:
-
Object
- Object
- Memosa::Cache
- Defined in:
- lib/memosa/cache.rb
Overview
This class is used to interact with the memoization cache.
Instance Method Summary collapse
-
#clear ⇒ self
Reset the cache.
-
#delete(key) ⇒ self
Delete a key from the cache.
-
#initialize(cache) ⇒ Cache
constructor
private
Create a new instance of Cache.
-
#merge!(values) ⇒ self
Add values to the cache.
Constructor Details
#initialize(cache) ⇒ Cache
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new instance of Memosa::Cache
11 12 13 |
# File 'lib/memosa/cache.rb', line 11 def initialize(cache) @cache = cache end |
Instance Method Details
#clear ⇒ self
Reset the cache
33 34 35 36 |
# File 'lib/memosa/cache.rb', line 33 def clear @cache.clear self end |
#delete(key) ⇒ self
Delete a key from the cache
45 46 47 48 |
# File 'lib/memosa/cache.rb', line 45 def delete(key) @cache.delete(key) self end |
#merge!(values) ⇒ self
Add values to the cache
22 23 24 25 |
# File 'lib/memosa/cache.rb', line 22 def merge!(values) @cache.merge!(values) self end |