Class: Workarea::AutoexpireCacheRedis
- Inherits:
-
Object
- Object
- Workarea::AutoexpireCacheRedis
- Defined in:
- lib/workarea/autoexpire_cache_redis.rb
Instance Method Summary collapse
- #[](url) ⇒ Object
- #[]=(url, value) ⇒ Object
- #del(url) ⇒ Object
-
#initialize(store, ttl = 259200) ⇒ AutoexpireCacheRedis
constructor
“time to live” of 3 days.
- #keys ⇒ Object
Constructor Details
#initialize(store, ttl = 259200) ⇒ AutoexpireCacheRedis
“time to live” of 3 days
8 9 10 11 |
# File 'lib/workarea/autoexpire_cache_redis.rb', line 8 def initialize(store, ttl = 259200) # "time to live" of 3 days @store = store @ttl = ttl end |
Instance Method Details
#[](url) ⇒ Object
13 14 15 |
# File 'lib/workarea/autoexpire_cache_redis.rb', line 13 def [](url) @store.get(url) end |
#[]=(url, value) ⇒ Object
17 18 19 |
# File 'lib/workarea/autoexpire_cache_redis.rb', line 17 def []=(url, value) @store.setex(url, @ttl, value) end |
#del(url) ⇒ Object
25 26 27 |
# File 'lib/workarea/autoexpire_cache_redis.rb', line 25 def del(url) @store.del(url) end |
#keys ⇒ Object
21 22 23 |
# File 'lib/workarea/autoexpire_cache_redis.rb', line 21 def keys @store.keys end |