Module: Sinatra::RedisCache
- Defined in:
- lib/sinatra/redis-cache.rb
Defined Under Namespace
Modules: Config
Classes: Cache
Instance Method Summary
collapse
Instance Method Details
#cache_del(keys) ⇒ Object
206
207
208
209
|
# 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) ⇒ Object
171
172
173
174
|
# 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 ⇒ Object
211
212
213
214
|
# File 'lib/sinatra/redis-cache.rb', line 211
def cache_flush
cache = Cache.new
cache.flush
end
|
#cache_get(key) ⇒ Object
176
177
178
179
|
# File 'lib/sinatra/redis-cache.rb', line 176
def cache_get(key)
cache = Cache.new
cache.get(key)
end
|
#cache_key_age(key) ⇒ Object
186
187
188
189
|
# 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) ⇒ Object
181
182
183
184
|
# File 'lib/sinatra/redis-cache.rb', line 181
def cache_key_properties(key)
cache = Cache.new
cache.properties(key)
end
|
#cache_key_ttl(key) ⇒ Object
191
192
193
194
|
# File 'lib/sinatra/redis-cache.rb', line 191
def cache_key_ttl(key)
cache = Cache.new
cache.ttl(key)
end
|
#cache_list_keys ⇒ Object
201
202
203
204
|
# 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) ⇒ Object
196
197
198
199
|
# File 'lib/sinatra/redis-cache.rb', line 196
def cache_store(key, value, expires=nil)
cache = Cache.new
cache.store(key, value, expires)
end
|