Class: Startback::Caching::Store
- Inherits:
-
Object
- Object
- Startback::Caching::Store
- 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
-
#saved ⇒ Object
readonly
Returns the value of attribute saved.
Instance Method Summary collapse
- #delete(key) ⇒ Object
- #exist?(key) ⇒ Boolean
- #get(key) ⇒ Object
-
#initialize ⇒ Store
constructor
A new instance of Store.
- #set(key, value, ttl) ⇒ Object
Constructor Details
#initialize ⇒ Store
Returns a new instance of Store.
11 12 13 |
# File 'lib/startback/caching/store.rb', line 11 def initialize @saved = {} end |
Instance Attribute Details
#saved ⇒ Object (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
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 |