Sha256: 0796669d8e3374a98c211a310f1340a2195cdf05384eeaf85e19cb140094cb31

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

module Rico
  class Value
    include Rico::Object

    # Gets the value of the object
    #
    # Returns the deserialized value
    alias_method :get, :data

    # Sets and stores the new value for the object
    #
    # value - the new value to store
    #
    # Returns the result of the store operation
    alias_method :set, :mutate

    # Sets the value if it does not exist
    #
    # value - the value to store
    #
    # Returns true if stored, false if not
    def setnx(value)
      if redis_object.exists?
        false
      else
        set value
        true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rico-0.0.1 lib/rico/value.rb