Module: Kotoshu::Cache::Cache Abstract
- Included in:
- LookupCache
- Defined in:
- lib/kotoshu/cache/cache.rb
Overview
Instance Method Summary collapse
-
#clear ⇒ self
abstract
Clear all entries from cache.
-
#delete(key) ⇒ Object?
abstract
Delete a value from cache.
-
#fetch(key) { ... } ⇒ Object
abstract
Retrieve a value from cache, or compute it.
-
#key?(key) ⇒ Boolean
abstract
Check if key exists in cache.
-
#read(key) ⇒ Object?
abstract
Read a value from cache.
-
#reset_stats ⇒ self
abstract
Reset statistics counters.
-
#size ⇒ Integer
abstract
Get number of entries in cache.
-
#stats ⇒ Hash
abstract
Get cache statistics.
-
#write(key, value) ⇒ Object
abstract
Write a value to cache.
Instance Method Details
#clear ⇒ self
This method is abstract.
Subclass must implement
Clear all entries from cache.
53 54 55 |
# File 'lib/kotoshu/cache/cache.rb', line 53 def clear raise NotImplementedError end |
#delete(key) ⇒ Object?
This method is abstract.
Subclass must implement
Delete a value from cache.
45 46 47 |
# File 'lib/kotoshu/cache/cache.rb', line 45 def delete(key) raise NotImplementedError end |
#fetch(key) { ... } ⇒ Object
This method is abstract.
Subclass must implement
Retrieve a value from cache, or compute it.
17 18 19 |
# File 'lib/kotoshu/cache/cache.rb', line 17 def fetch(key, &block) raise NotImplementedError end |
#key?(key) ⇒ Boolean
This method is abstract.
Subclass must implement
Check if key exists in cache.
62 63 64 |
# File 'lib/kotoshu/cache/cache.rb', line 62 def key?(key) raise NotImplementedError end |
#read(key) ⇒ Object?
This method is abstract.
Subclass must implement
Read a value from cache.
36 37 38 |
# File 'lib/kotoshu/cache/cache.rb', line 36 def read(key) raise NotImplementedError end |
#reset_stats ⇒ self
This method is abstract.
Subclass must implement
Reset statistics counters.
86 87 88 |
# File 'lib/kotoshu/cache/cache.rb', line 86 def reset_stats raise NotImplementedError end |
#size ⇒ Integer
This method is abstract.
Subclass must implement
Get number of entries in cache.
70 71 72 |
# File 'lib/kotoshu/cache/cache.rb', line 70 def size raise NotImplementedError end |
#stats ⇒ Hash
This method is abstract.
Subclass must implement
Get cache statistics.
78 79 80 |
# File 'lib/kotoshu/cache/cache.rb', line 78 def stats raise NotImplementedError end |
#write(key, value) ⇒ Object
This method is abstract.
Subclass must implement
Write a value to cache.
27 28 29 |
# File 'lib/kotoshu/cache/cache.rb', line 27 def write(key, value) raise NotImplementedError end |