Sha256: d6b7cd02615527ffd20d3180148b1929fac083dd8a478135cb16c85b0296e5ca

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 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
          clear
          hash.each_pair do |key, value|
            backend.hset namespace, key, value
          end
        end
        
        # Clears the hash.
        #
        def clear
          backend.del namespace
        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

1 entries across 1 versions & 1 rubygems

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