Sha256: b7d8f297c46444f0f614a395560f0f22b962ab5c3cc6000ff384269ee7a368c2

Contents?: true

Size: 652 Bytes

Versions: 2

Compression:

Stored size: 652 Bytes

Contents

module Internals

  module Index

    class Redis

      class StringHash < Basic

        # Writes the hash into Redis.
        #
        # TODO Could we use multi?
        #
        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

2 entries across 2 versions & 1 rubygems

Version Path
picky-2.0.0 lib/picky/internals/index/redis/string_hash.rb
picky-2.0.0.pre3 lib/picky/internals/index/redis/string_hash.rb