lib/picky/backends/redis/list.rb in picky-4.0.0pre5 vs lib/picky/backends/redis/list.rb in picky-4.0.0pre6
- old
+ new
@@ -16,9 +16,18 @@
client.keys(redis_key).each do |key|
client.del key
end
end
+ # Size of the list(s).
+ #
+ def size
+ redis_key = "#{namespace}:*"
+ client.keys(redis_key).inject(0) do |total, key|
+ total + client.zcard(key)
+ end
+ end
+
# Deletes the list for the key.
#
def delete key
client.del "#{namespace}:#{key}"
end
\ No newline at end of file