lib/rico/value.rb in rico-0.0.1 vs lib/rico/value.rb in rico-0.1.0
- old
+ new
@@ -18,14 +18,27 @@
#
# value - the value to store
#
# Returns true if stored, false if not
def setnx(value)
- if redis_object.exists?
+ if exists?
false
else
set value
true
end
+ end
+
+ # Resolve conflict between one or more RObject siblings
+ #
+ # This currently just returns the first sibling
+ #
+ # robjects - array of RObjects to resolve
+ #
+ # Returns a single RObject result or nil
+ def self.resolve(robject)
+ obj = Riak::RObject.new(robject.bucket, robject.key)
+ obj.data = robject.siblings.first.data
+ obj
end
end
end