Class: RailsWebCache::RedisCacheStore

Inherits:
Base
  • Object
show all
Defined in:
lib/rails_web_cache/redis_cache_store.rb

Instance Attribute Summary

Attributes inherited from Base

#cache

Instance Method Summary collapse

Methods inherited from Base

#clear, #delete, #initialize

Constructor Details

This class inherits a constructor from RailsWebCache::Base

Instance Method Details

#entry(key, options = {}) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/rails_web_cache/redis_cache_store.rb', line 22

def entry(key, options = {})
  return unless key
  return unless type(key) == 'string'
  entry = read_entry(key, options)
  return unless entry
  RailsWebCache::Entry.new(entry)
end

#keysObject



9
10
11
# File 'lib/rails_web_cache/redis_cache_store.rb', line 9

def keys
  redis.keys
end

#keys_sizeObject



5
6
7
# File 'lib/rails_web_cache/redis_cache_store.rb', line 5

def keys_size
  redis.dbsize
end

#read(key) ⇒ Object



13
14
15
16
# File 'lib/rails_web_cache/redis_cache_store.rb', line 13

def read(key)
  return unless type(key) == 'string'
  cache.read(key) if key
end

#search(query = '') ⇒ Object



18
19
20
# File 'lib/rails_web_cache/redis_cache_store.rb', line 18

def search(query = '')
  redis.scan_each(match: "*#{query.downcase}*").to_a if query
end