Skip to content

Commit

Permalink
updated redis changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chuck ha authored and chuck ha committed Nov 9, 2010
1 parent 646ad24 commit 58d4896
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/redisbloom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ def insert(key, ttl=nil)
ttl = @opts[:ttl] if ttl.nil?

indexes_for(key).each do |idx|
@db.incr(idx, 1)
@db.incr idx
@db.expire(idx, ttl) if ttl
end
end

def delete(key)
indexes_for(key).each do |idx|
if @db.decr(idx, 1) <= 0
@db.delete(idx)
if @db.decr(idx).to_i <= 0
@db.del(idx)
end
end
end

def include?(*keys)
indexes = keys.collect { |key| indexes_for(key) }
not @db.mget(indexes.flatten).include? nil
not @db.mget(*indexes.flatten).include? nil
end

def num_set
Expand Down

0 comments on commit 58d4896

Please sign in to comment.