Sha256: 34bc65b9c7faa3f19a259ee0294b16fa8992b150d8c44f9ec16a7fb0f5569df1

Contents?: true

Size: 761 Bytes

Versions: 12

Compression:

Stored size: 761 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

        # Set a single value
        #
        def []= key, value
          client.hset namespace, key, value
        end

      end

    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
picky-3.6.7 lib/picky/backends/redis/string.rb
picky-3.6.6 lib/picky/backends/redis/string.rb
picky-3.6.4 lib/picky/backends/redis/string.rb
picky-3.6.3 lib/picky/backends/redis/string.rb
picky-3.6.2 lib/picky/backends/redis/string.rb
picky-3.6.1 lib/picky/backends/redis/string.rb
picky-3.6.0 lib/picky/backends/redis/string.rb
picky-3.5.4 lib/picky/backends/redis/string.rb
picky-3.5.3 lib/picky/backends/redis/string.rb
picky-3.5.2 lib/picky/backends/redis/string.rb
picky-3.5.1 lib/picky/backends/redis/string.rb
picky-3.5.0 lib/picky/backends/redis/string.rb