Class: RedisWebManager::Data
- Inherits:
-
Base
- Object
- Base
- RedisWebManager::Data
show all
- Defined in:
- lib/redis_web_manager/data.rb
Constant Summary
collapse
- BASE =
'RedisWebManager'
Instance Attribute Summary
Attributes inherited from Base
#instance
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#flush ⇒ Object
17
18
19
|
# File 'lib/redis_web_manager/data.rb', line 17
def flush
data.map { |key| redis.del(key) }
end
|
#keys ⇒ Object
7
8
9
|
# File 'lib/redis_web_manager/data.rb', line 7
def keys
data.map { |key| JSON.parse(redis.get(key), symbolize_names: true) }
end
|
11
12
13
14
15
|
# File 'lib/redis_web_manager/data.rb', line 11
def perform
now = Time.now.to_i
seconds = (now + lifespan.to_i) - now
redis.setex("#{BASE}_#{instance}_#{now}", seconds, serialize.to_json)
end
|