Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 11 additions and 2 deletions.
  1. +9 −1 lib/mock_redis/database.rb
  2. +2 −1  lib/mock_redis/set_methods.rb
View
10 lib/mock_redis/database.rb
@@ -334,6 +334,14 @@ def ttl(key)
-1
end
end
+
+ def pttl(key)
+ if has_expiration?(key)
+ (expiration(key).to_i - Time.now.to_i) * 1000
+ else
+ -1
+ end
+ end
def type(key)
if !exists(key)
@@ -365,7 +373,7 @@ def assert_valid_timeout(timeout)
end
def can_incr?(value)
- value.nil? || looks_like_integer?(value)
+ value.nil? || looks_like_integer?(value.to_s)
end
def extract_timeout(arglist)
View
3  lib/mock_redis/set_methods.rb
@@ -73,7 +73,8 @@ def spop(key)
end
def srandmember(key)
- with_set_at(key, &:first)
+ members = with_set_at(key, &:to_a)
+ members[rand(members.length)]
end
def srem(key, member)

No commit comments for this range

Something went wrong with that request. Please try again.