Class: Locomotive::Steam::Adapters::Filesystem::SimpleCacheStore
- Inherits:
-
Object
- Object
- Locomotive::Steam::Adapters::Filesystem::SimpleCacheStore
- Defined in:
- lib/locomotive/steam/adapters/filesystem/simple_cache_store.rb
Constant Summary collapse
- @@store =
{}
Instance Method Summary collapse
-
#_store ⇒ Object
:nocov:.
- #clear ⇒ Object
- #delete(name) ⇒ Object
- #fetch(name, options = nil, &block) ⇒ Object
- #read(name, options = nil) ⇒ Object
- #write(name, value, options = nil) ⇒ Object
Instance Method Details
#_store ⇒ Object
:nocov:
34 35 36 |
# File 'lib/locomotive/steam/adapters/filesystem/simple_cache_store.rb', line 34 def _store @@store end |
#clear ⇒ Object
25 26 27 |
# File 'lib/locomotive/steam/adapters/filesystem/simple_cache_store.rb', line 25 def clear @@store.clear end |
#delete(name) ⇒ Object
29 30 31 |
# File 'lib/locomotive/steam/adapters/filesystem/simple_cache_store.rb', line 29 def delete(name) @@store.delete(name) end |
#fetch(name, options = nil, &block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/locomotive/steam/adapters/filesystem/simple_cache_store.rb', line 9 def fetch(name, = nil, &block) if block_given? read(name) || write(name, yield) else read(name) end end |
#read(name, options = nil) ⇒ Object
17 18 19 |
# File 'lib/locomotive/steam/adapters/filesystem/simple_cache_store.rb', line 17 def read(name, = nil) @@store[name] end |
#write(name, value, options = nil) ⇒ Object
21 22 23 |
# File 'lib/locomotive/steam/adapters/filesystem/simple_cache_store.rb', line 21 def write(name, value, = nil) @@store[name] = value end |