module Sinatra::RedisCache

Public Instance Methods

cache_del(keys) click to toggle source
# File lib/sinatra/redis-cache.rb, line 206
def cache_del(keys)
  cache = Cache.new
  cache.del(keys)
end
cache_do(key, expires=nil, &block) click to toggle source
# File lib/sinatra/redis-cache.rb, line 171
def cache_do(key, expires=nil, &block)
  cache = Cache.new
  cache.do(key, expires, block)
end
cache_flush() click to toggle source
# File lib/sinatra/redis-cache.rb, line 211
def cache_flush
  cache = Cache.new
  cache.flush
end
cache_get(key) click to toggle source
# File lib/sinatra/redis-cache.rb, line 176
def cache_get(key)
  cache = Cache.new
  cache.get(key)
end
cache_key_age(key) click to toggle source
# File lib/sinatra/redis-cache.rb, line 186
def cache_key_age(key)
  cache = Cache.new
  Time.now.utc.to_i - cache.properties(key)[:created_at]
end
cache_key_properties(key) click to toggle source
# File lib/sinatra/redis-cache.rb, line 181
def cache_key_properties(key)
  cache = Cache.new
  cache.properties(key)
end
cache_key_ttl(key) click to toggle source
# File lib/sinatra/redis-cache.rb, line 191
def cache_key_ttl(key)
  cache = Cache.new
  cache.ttl(key)
end
cache_list_keys() click to toggle source
# File lib/sinatra/redis-cache.rb, line 201
def cache_list_keys
  cache = Cache.new
  cache.all_keys(with_namespace: false)
end
cache_store(key, value, expires=nil) click to toggle source
# File lib/sinatra/redis-cache.rb, line 196
def cache_store(key, value, expires=nil)
  cache = Cache.new
  cache.store(key, value, expires)
end