Class: Jpzip::Cache
- Inherits:
-
Object
- Object
- Jpzip::Cache
- Defined in:
- lib/jpzip/cache.rb
Overview
Cache is the abstract interface a user-supplied L2 persistent cache must satisfy. Implementations are free to add TTLs, eviction, or backends (file, Redis, IndexedDB-equivalent, etc.).
Subclasses MUST override every method below.
Instance Method Summary collapse
-
#clear ⇒ Object
Clear every entry in the cache.
-
#delete(key) ⇒ Object
Delete the entry stored under
key(no-op if absent). -
#get(key) ⇒ Object
Get the bytes stored under
key, or nil if absent. -
#set(key, value) ⇒ Object
Set
value(a String of bytes) underkey.
Instance Method Details
#clear ⇒ Object
Clear every entry in the cache.
28 29 30 |
# File 'lib/jpzip/cache.rb', line 28 def clear raise NotImplementedError, "#{self.class}#clear must be implemented" end |
#delete(key) ⇒ Object
Delete the entry stored under key (no-op if absent).
23 24 25 |
# File 'lib/jpzip/cache.rb', line 23 def delete(key) raise NotImplementedError, "#{self.class}#delete must be implemented" end |
#get(key) ⇒ Object
Get the bytes stored under key, or nil if absent.
13 14 15 |
# File 'lib/jpzip/cache.rb', line 13 def get(key) raise NotImplementedError, "#{self.class}#get must be implemented" end |
#set(key, value) ⇒ Object
Set value (a String of bytes) under key.
18 19 20 |
# File 'lib/jpzip/cache.rb', line 18 def set(key, value) raise NotImplementedError, "#{self.class}#set must be implemented" end |