lib/picky/backend/redis/string_hash.rb in picky-2.7.0 vs lib/picky/backend/redis/string_hash.rb in picky-3.0.0.pre1
- old
+ new
@@ -1,37 +1,41 @@
-module Backend
+module Picky
- class Redis
+ module Backend
- class StringHash < Basic
+ class Redis
- # 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|
- backend.hset namespace, key, value
+ class StringHash < Basic
+
+ # 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|
+ backend.hset namespace, key, value
+ end
end
- end
- # Clears the hash.
- #
- def clear
- backend.del namespace
- end
+ # Clears the hash.
+ #
+ def clear
+ backend.del namespace
+ end
- # Get a collection.
- #
- def collection key
- raise "Can't retrieve collection for :#{key} from a StringHash. Use Index::Redis::ListHash."
- end
+ # Get a collection.
+ #
+ def collection key
+ raise "Can't retrieve collection for :#{key} from a StringHash. Use Indexes::Redis::ListHash."
+ end
- # Get a single value.
- #
- def member key
- backend.hget namespace, key
+ # Get a single value.
+ #
+ def member key
+ backend.hget namespace, key
+ end
+
end
end
end
\ No newline at end of file