lib/tabs/storage.rb in tabs-0.6.1 vs lib/tabs/storage.rb in tabs-0.6.2

- old
+ new

@@ -22,11 +22,18 @@ def set(key, value) redis.set("tabs:#{key}", value) end def del(*keys) + return 0 if keys.empty? prefixed_keys = keys.map { |k| "tabs:#{k}" } redis.del(*prefixed_keys) + end + + def del_by_prefix(pattern) + keys = redis.keys("tabs:#{pattern}*") + return 0 if keys.empty? + redis.del(*keys) end def incr(key) redis.incr("tabs:#{key}") end