Class: Fastentry::RedisCache

Inherits:
Cache
  • Object
show all
Defined in:
lib/fastentry.rb

Instance Method Summary collapse

Methods inherited from Cache

#expiration_for, for, #read

Instance Method Details

#keysObject



91
92
93
# File 'lib/fastentry.rb', line 91

def keys
  cache.redis.keys
end

#number_of_keysObject



95
96
97
# File 'lib/fastentry.rb', line 95

def number_of_keys
  cache.redis.dbsize
end

#search(query: '') ⇒ Object



104
105
106
# File 'lib/fastentry.rb', line 104

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

#select(from: 0, amount: 20) ⇒ Object



99
100
101
102
# File 'lib/fastentry.rb', line 99

def select(from: 0, amount: 20)
  count = adjusted_amount(from, amount)
  cache.redis.scan(from, count: count)[1]
end