Class: Rack::Cache::EntityStore::Redis
Constant Summary
REDIS
Instance Method Summary
collapse
Methods included from RedisBase
included, #initialize, #open
Instance Method Details
#exist?(key) ⇒ Boolean
11
12
13
|
# File 'lib/rack/cache/redis_entitystore.rb', line 11
def exist?(key)
cache.exists key
end
|
#purge(key) ⇒ Object
28
29
30
31
|
# File 'lib/rack/cache/redis_entitystore.rb', line 28
def purge(key)
cache.del key
nil
end
|
#read(key) ⇒ Object
15
16
17
|
# File 'lib/rack/cache/redis_entitystore.rb', line 15
def read(key)
cache.get key
end
|
#write(body, ttl = 0) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/rack/cache/redis_entitystore.rb', line 19
def write(body, ttl=0)
buf = StringIO.new
key, size = slurp(body) {|part| buf.write(part) }
ttl = ttl.to_i.zero? ? default_ttl : ttl
return unless cache.setex(key, ttl, buf.string)
[key, size]
end
|