Sha256: 66d697f9b9403c5456f1a27648b35f56dcd95e5702bd52ec5134edc56bd5b56b

Contents?: true

Size: 737 Bytes

Versions: 6

Compression:

Stored size: 737 Bytes

Contents

class Redis
  class Store < self
    module Interface
      def get(key, options = nil)
        super(key)
      end

      REDIS_SET_OPTIONS = %i(ex px nx xx keepttl).freeze
      private_constant :REDIS_SET_OPTIONS

      def set(key, value, options = nil)
        if options && REDIS_SET_OPTIONS.any? { |k| options.key?(k) }
          kwargs = REDIS_SET_OPTIONS.each_with_object({}) { |key, h| h[key] = options[key] if options.key?(key) }
          super(key, value, **kwargs)
        else
          super(key, value)
        end
      end

      def setnx(key, value, options = nil)
        super(key, value)
      end

      def setex(key, expiry, value, options = nil)
        super(key, expiry, value)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
redis-store-1.11.0 lib/redis/store/interface.rb
redis-store-1.10.0 lib/redis/store/interface.rb
redis-store-pika-1.9.2.1 lib/redis/store/interface.rb
redis-store-1.9.2 lib/redis/store/interface.rb
redis-store-1.9.1 lib/redis/store/interface.rb
redis-store-1.9.0 lib/redis/store/interface.rb