Sha256: 217c99111cffac1b7251d65631df079daaed3fab836184a95177b53e82e96918

Contents?: true

Size: 264 Bytes

Versions: 1

Compression:

Stored size: 264 Bytes

Contents

class Kredis::Types::Counter < Kredis::Types::Proxying
  proxying :multi, :set, :incrby, :get

  attr_accessor :expires_in

  def increment(by: 1)
    multi do
      set 0, ex: expires_in, nx: true
      incrby by
    end
  end

  def value
    get.to_i
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kredis-0.2.0 lib/kredis/types/counter.rb