lib/split/redis_interface.rb in split-4.0.2 vs lib/split/redis_interface.rb in split-4.0.3
- old
+ new
@@ -9,21 +9,28 @@
def persist_list(list_name, list_values)
if list_values.length > 0
redis.multi do |multi|
tmp_list = "#{list_name}_tmp"
+ tmp_list += redis_namespace_used? ? "{#{Split.redis.namespace}:#{list_name}}" : "{#{list_name}}"
multi.rpush(tmp_list, list_values)
multi.rename(tmp_list, list_name)
end
end
list_values
end
def add_to_set(set_name, value)
+ return redis.sadd?(set_name, value) if redis.respond_to?(:sadd?)
+
redis.sadd(set_name, value)
end
private
attr_accessor :redis
+
+ def redis_namespace_used?
+ Redis.const_defined?("Namespace") && Split.redis.is_a?(Redis::Namespace)
+ end
end
end