Class: Rack::Cache::EntityStore::Redis
- Inherits:
-
RedisBase
- Object
- Rack::Cache::EntityStore
- RedisBase
- Rack::Cache::EntityStore::Redis
- Defined in:
- lib/rack/cache/redis_entitystore.rb
Constant Summary
Constants inherited from Rack::Cache::EntityStore
Instance Attribute Summary
Attributes inherited from RedisBase
Instance Method Summary collapse
- #exist?(key) ⇒ Boolean
-
#initialize(server, options = {}) ⇒ Redis
constructor
A new instance of Redis.
- #purge(key) ⇒ Object
- #read(key) ⇒ Object
- #write(body) ⇒ Object
Methods inherited from RedisBase
Constructor Details
Instance Method Details
#exist?(key) ⇒ Boolean
28 29 30 |
# File 'lib/rack/cache/redis_entitystore.rb', line 28 def exist?(key) cache.exists key end |
#purge(key) ⇒ Object
42 43 44 45 |
# File 'lib/rack/cache/redis_entitystore.rb', line 42 def purge(key) cache.del key nil end |
#read(key) ⇒ Object
32 33 34 |
# File 'lib/rack/cache/redis_entitystore.rb', line 32 def read(key) cache.get key end |
#write(body) ⇒ Object
36 37 38 39 40 |
# File 'lib/rack/cache/redis_entitystore.rb', line 36 def write(body) buf = StringIO.new key, size = slurp(body){|part| buf.write(part) } [key, size] if cache.set(key, buf.string) end |