Permalink
Browse files

Added SortedSet#member? and CoreCommands#ttl per Karl Varga

  • Loading branch information...
1 parent ae596a0 commit eb4485f5f89a707b781b72ef1e6defe0084e6774 Nate Wiger committed Jul 21, 2011
Showing with 16 additions and 1 deletion.
  1. +6 −0 CHANGELOG.rdoc
  2. +5 −1 lib/redis/helpers/core_commands.rb
  3. +5 −0 lib/redis/sorted_set.rb
View
6 CHANGELOG.rdoc
@@ -1,5 +1,11 @@
= Changelog for Redis::Objects
+== 0.5.2 [Development]
+
+* Added Redis::SortedSet#member? method [Karl Varga]
+
+* Added +ttl+ method to CoreCommands [Karl Varga]
+
== 0.5.1 [Final] (23 May 2011)
* Fixed super class delegation conflicts with Redis Counters vs ActiveRecord [Tim Aßmann]
View
6 lib/redis/helpers/core_commands.rb
@@ -37,7 +37,11 @@ def expire(seconds)
def expireat(unixtime)
redis.expire key, unixtime
end
-
+
+ def ttl
+ redis.ttl(@key).seconds
+ end
+
def move(dbindex)
redis.move key, dbindex
end
View
5 lib/redis/sorted_set.rb
@@ -286,6 +286,11 @@ def range_size(min, max)
redis.zcount(key, min, max)
end
+ # Return a boolean indicating whether +value+ is a member.
+ def member?(value)
+ !redis.zscore(key, to_redis(value)).nil?
+ end
+
private
def keys_from_objects(sets)

0 comments on commit eb4485f

Please sign in to comment.