Module: Cache::ActiveSupportCacheStore
- Defined in:
- lib/cache/active_support_cache_store.rb
Instance Method Summary collapse
- #_delete(k) ⇒ Object
- #_exist?(k) ⇒ Boolean
- #_flush ⇒ Object
-
#_get(k) ⇒ Object
–.
- #_get_multi(ks) ⇒ Object
- #_set(k, v, ttl) ⇒ Object
-
#fetch(k, ttl = nil, &blk) ⇒ Object
native.
Instance Method Details
#_delete(k) ⇒ Object
25 26 27 |
# File 'lib/cache/active_support_cache_store.rb', line 25 def _delete(k) @metal.delete k end |
#_exist?(k) ⇒ Boolean
33 34 35 36 |
# File 'lib/cache/active_support_cache_store.rb', line 33 def _exist?(k) @metal.exist? k # !get(k).nil? end |
#_flush ⇒ Object
29 30 31 |
# File 'lib/cache/active_support_cache_store.rb', line 29 def _flush @metal.clear end |
#_get(k) ⇒ Object
–
9 10 11 |
# File 'lib/cache/active_support_cache_store.rb', line 9 def _get(k) @metal.read k end |
#_get_multi(ks) ⇒ Object
13 14 15 |
# File 'lib/cache/active_support_cache_store.rb', line 13 def _get_multi(ks) @metal.read_multi *ks end |
#_set(k, v, ttl) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/cache/active_support_cache_store.rb', line 17 def _set(k, v, ttl) if ttl == 0 @metal.write k, v # never expire else @metal.write k, v, :expires_in => ttl end end |
#fetch(k, ttl = nil, &blk) ⇒ Object
native
3 4 5 6 |
# File 'lib/cache/active_support_cache_store.rb', line 3 def fetch(k, ttl = nil, &blk) handle_fork @metal.fetch k, { :expires_in => extract_ttl(ttl) }, &blk end |