lib/fakeredis/keys.rb in fakeredis-0.1.1 vs lib/fakeredis/keys.rb in fakeredis-0.1.2
- old
+ new
@@ -24,10 +24,10 @@
def expireat(key, timestamp)
@expires[key] = (Time.at(timestamp) - Time.now).to_i
true
end
- def keys(pattern)
+ def keys(pattern = "*")
regexp = Regexp.new(pattern.split("*").map { |r| Regexp.escape(r) }.join(".*"))
@data.keys.select { |key| key =~ regexp }
end
def persist(key)