Class: Resterl::Caches::KeyPrefixDecorator

Inherits:
CacheInterface show all
Defined in:
lib/resterl/caches/key_prefix_decorator.rb

Instance Method Summary collapse

Constructor Details

#initialize(cache, key_prefix) ⇒ KeyPrefixDecorator

Returns a new instance of KeyPrefixDecorator.



2
3
4
5
# File 'lib/resterl/caches/key_prefix_decorator.rb', line 2

def initialize cache, key_prefix
  @cache = cache
  @key_prefix = key_prefix
end

Instance Method Details

#delete(key) ⇒ Object



12
13
14
# File 'lib/resterl/caches/key_prefix_decorator.rb', line 12

def delete key
  @cache.delete key_ext(key)
end

#read(key) ⇒ Object



6
7
8
# File 'lib/resterl/caches/key_prefix_decorator.rb', line 6

def read key
  @cache.read key_ext(key)
end

#write(key, value, expires_in) ⇒ Object



9
10
11
# File 'lib/resterl/caches/key_prefix_decorator.rb', line 9

def write key, value, expires_in
  @cache.write key_ext(key), value, expires_in
end