lib/picky/backends/redis/string.rb in picky-3.6.7 vs lib/picky/backends/redis/string.rb in picky-3.6.8
- old
+ new
@@ -4,24 +4,32 @@
class Redis
class String < Basic
+ # Clears the hash.
+ #
+ def clear
+ client.del namespace
+ end
+
+ # Deletes the single value.
+ #
+ def delete key
+ client.hdel namespace, key
+ end
+
# Writes the hash into Redis.
#
# Note: We could use multi, but it did not help.
#
def dump hash
- clear
- hash.each_pair do |key, value|
- client.hset namespace, key, value
+ unless @immediate
+ clear
+ hash.each_pair do |key, value|
+ client.hset namespace, key, value
+ end
end
- end
-
- # Clears the hash.
- #
- def clear
- client.del namespace
end
# Get a single value.
#
# Internal API method for the index.
\ No newline at end of file