Sha256: b08a24580b29125b1634d58db4e50d8a0f7662f09c5771c8b9554181dfe97b6f

Contents?: true

Size: 642 Bytes

Versions: 1

Compression:

Stored size: 642 Bytes

Contents

module Picky

  module Backends

    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|
            client.hset namespace, key, value
          end
        end

        # Clears the hash.
        #
        def clear
          client.del namespace
        end

        # Get a single value.
        #
        # Internal API method for the index.
        #
        def [] key
          client.hget namespace, key
        end

      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picky-3.1.0 lib/picky/backends/redis/string_hash.rb