Class: Juno::Proxy

Inherits:
Base
  • Object
show all
Defined in:
lib/juno/proxy.rb

Overview

Proxy base class

Direct Known Subclasses

Expires, Lock, Logger, Transformer

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, #fetch

Constructor Details

#initialize(adapter, options = {}) ⇒ Proxy

Constructor



11
12
13
# File 'lib/juno/proxy.rb', line 11

def initialize(adapter, options = {})
  @adapter = adapter
end

Instance Attribute Details

#adapterObject (readonly)



5
6
7
# File 'lib/juno/proxy.rb', line 5

def adapter
  @adapter
end

Instance Method Details

#clear(options = {}) ⇒ void

This method returns an undefined value.

Clear all keys in this store



61
62
63
64
# File 'lib/juno/proxy.rb', line 61

def clear(options = {})
  @adapter.clear(options)
  self
end

#closeObject

Close this store



68
69
70
# File 'lib/juno/proxy.rb', line 68

def close
  @adapter.close
end

#delete(key, options = {}) ⇒ Object

Delete the key from the store and return the current value



52
53
54
# File 'lib/juno/proxy.rb', line 52

def delete(key, options = {})
  @adapter.delete(key, options)
end

#key?(key, options = {}) ⇒ Boolean

Exists the value with key



21
22
23
# File 'lib/juno/proxy.rb', line 21

def key?(key, options = {})
  @adapter.key?(key, options)
end

#load(key, options = {}) ⇒ Object

Fetch value with key. Return nil if the key doesn’t exist



31
32
33
# File 'lib/juno/proxy.rb', line 31

def load(key, options = {})
  @adapter.load(key, options)
end

#store(key, value, options = {}) ⇒ Object

Store value with key



42
43
44
# File 'lib/juno/proxy.rb', line 42

def store(key, value, options = {})
  @adapter.store(key, value, options)
end