Sha256: 447388720b3d983f4a325457294749bf31308f7a37d4c5f3f3caa69c936f0ca5

Contents?: true

Size: 408 Bytes

Versions: 3

Compression:

Stored size: 408 Bytes

Contents

# frozen_string_literal: true

class Kredis::Types::Flag < Kredis::Types::Proxying
  prepend Kredis::DefaultValues

  proxying :set, :exists?, :del

  attr_accessor :expires_in

  def mark(expires_in: nil, force: true)
    set 1, ex: expires_in || self.expires_in, nx: !force
  end

  def marked?
    exists?
  end

  def remove
    del
  end

  private
    def set_default
      mark if default
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kredis-1.7.0 lib/kredis/types/flag.rb
kredis-1.6.1 lib/kredis/types/flag.rb
kredis-1.6.0 lib/kredis/types/flag.rb