Sha256: 19950021eda2836d7d91d83dcd999e8a5c77c6eb0005ab6118a0a51d2e6c94fa

Contents?: true

Size: 1.02 KB

Versions: 108

Compression:

Stored size: 1.02 KB

Contents

module Picky

  module Backends

    class Redis

      class String < Basic

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

        # Returns the size of the hash.
        #
        def size
          client.hlen 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 @realtime
            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

108 entries across 108 versions & 1 rubygems

Version Path
picky-4.5.5 lib/picky/backends/redis/string.rb
picky-4.5.4 lib/picky/backends/redis/string.rb
picky-4.5.3 lib/picky/backends/redis/string.rb
picky-4.5.2 lib/picky/backends/redis/string.rb
picky-4.5.1 lib/picky/backends/redis/string.rb
picky-4.5.0 lib/picky/backends/redis/string.rb
picky-4.4.2 lib/picky/backends/redis/string.rb
picky-4.4.1 lib/picky/backends/redis/string.rb
picky-4.4.0 lib/picky/backends/redis/string.rb
picky-4.3.2 lib/picky/backends/redis/string.rb
picky-4.3.1 lib/picky/backends/redis/string.rb
picky-4.3.0 lib/picky/backends/redis/string.rb
picky-4.2.4 lib/picky/backends/redis/string.rb
picky-4.2.3 lib/picky/backends/redis/string.rb
picky-4.2.2 lib/picky/backends/redis/string.rb
picky-4.2.1 lib/picky/backends/redis/string.rb
picky-4.2.0 lib/picky/backends/redis/string.rb
picky-4.1.0 lib/picky/backends/redis/string.rb
picky-4.0.9 lib/picky/backends/redis/string.rb
picky-4.0.8 lib/picky/backends/redis/string.rb