Sha256: efdaea0e41e3dec50603d729e14166091077af4ade90170599711918e130ebda

Contents?: true

Size: 930 Bytes

Versions: 11

Compression:

Stored size: 930 Bytes

Contents

module Picky

  module Backends

    class Redis

      class String < Basic

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

        # Deletes the single value.
        #
        def delete key
          client.hdel namespace, key
        end

        # Writes the hash into Redis.
        #
        # Note: We could use multi, but it did not help.
        #
        def dump hash
          unless @immediate
            clear
            hash.each_pair do |key, value|
              client.hset namespace, key, value
            end
          end
        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

11 entries across 11 versions & 1 rubygems

Version Path
picky-4.0.0pre2 lib/picky/backends/redis/string.rb
picky-4.0.0pre1 lib/picky/backends/redis/string.rb
picky-3.6.16 lib/picky/backends/redis/string.rb
picky-3.6.15 lib/picky/backends/redis/string.rb
picky-3.6.14 lib/picky/backends/redis/string.rb
picky-3.6.13 lib/picky/backends/redis/string.rb
picky-3.6.12 lib/picky/backends/redis/string.rb
picky-3.6.11 lib/picky/backends/redis/string.rb
picky-3.6.10 lib/picky/backends/redis/string.rb
picky-3.6.9 lib/picky/backends/redis/string.rb
picky-3.6.8 lib/picky/backends/redis/string.rb