Class: Startback::Caching::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/startback/caching/store.rb

Overview

Caching store specification & dummy implementation.

This class should not be used in real project, as it implements See the ‘cache’ gem that provides conforming implementations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStore

Returns a new instance of Store.



11
12
13
# File 'lib/startback/caching/store.rb', line 11

def initialize
  @saved = {}
end

Instance Attribute Details

#savedObject (readonly)

Returns the value of attribute saved.



14
15
16
# File 'lib/startback/caching/store.rb', line 14

def saved
  @saved
end

Instance Method Details

#delete(key) ⇒ Object



28
29
30
# File 'lib/startback/caching/store.rb', line 28

def delete(key)
  saved.delete(key)
end

#exist?(key) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/startback/caching/store.rb', line 16

def exist?(key)
  saved.has_key?(key)
end

#get(key) ⇒ Object



20
21
22
# File 'lib/startback/caching/store.rb', line 20

def get(key)
  saved[key]
end

#set(key, value, ttl) ⇒ Object



24
25
26
# File 'lib/startback/caching/store.rb', line 24

def set(key, value, ttl)
  saved[key] = value
end