Class: Jpzip::Cache

Inherits:
Object
  • Object
show all
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

Instance Method Details

#clearObject

Clear every entry in the cache.

Raises:

  • (NotImplementedError)


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).

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/jpzip/cache.rb', line 18

def set(key, value)
  raise NotImplementedError, "#{self.class}#set must be implemented"
end