Sha256: 7f510257baca4c0f9c72428e41996ed1ae0115a909a9f0df48cc6031ebcae78e

Contents?: true

Size: 638 Bytes

Versions: 22

Compression:

Stored size: 638 Bytes

Contents

module Picky

  module Backends

    class Redis

      class String < 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

22 entries across 22 versions & 1 rubygems

Version Path
picky-3.1.2 lib/picky/backends/redis/string.rb
picky-3.1.1 lib/picky/backends/redis/string.rb