Sha256: d0338c58e9ffce93ff9c4b606d89683fd7104abf3a5c7dba13faca5cda9d9779

Contents?: true

Size: 674 Bytes

Versions: 12

Compression:

Stored size: 674 Bytes

Contents

module Internals

  module Index

    class Redis

      class StringHash < Basic

        # Writes the hash into Redis.
        #
        # Note: We could use multi, but it did not help.
        #
        def dump hash
          redis = backend
          hash.each_pair do |key, value|
            redis.hset namespace, key, value
          end
        end

        # Get a collection.
        #
        def collection sym
          raise "Can't retrieve a collection from a StringHash. Use Index::Redis::ListHash."
        end

        # Get a single value.
        #
        def member sym
          backend.hget namespace, sym
        end

      end

    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
picky-2.5.1 lib/picky/internals/index/redis/string_hash.rb
picky-2.5.0 lib/picky/internals/index/redis/string_hash.rb
picky-2.4.3 lib/picky/internals/index/redis/string_hash.rb
picky-2.4.2 lib/picky/internals/index/redis/string_hash.rb
picky-2.4.1 lib/picky/internals/index/redis/string_hash.rb
picky-2.4.0 lib/picky/internals/index/redis/string_hash.rb
picky-2.3.0 lib/picky/internals/index/redis/string_hash.rb
picky-2.2.1 lib/picky/internals/index/redis/string_hash.rb
picky-2.2.0 lib/picky/internals/index/redis/string_hash.rb
picky-2.1.2 lib/picky/internals/index/redis/string_hash.rb
picky-2.1.1 lib/picky/internals/index/redis/string_hash.rb
picky-2.1.0 lib/picky/internals/index/redis/string_hash.rb