Skip to content
Browse files

Support cache clients that return boolean values like Dalli

  • Loading branch information...
1 parent 8e979da commit 884881ad81a59973f9f63841babe77494ddc7d6b @balexand balexand committed
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/openid/store/memcache.rb
View
12 lib/openid/store/memcache.rb
@@ -63,7 +63,11 @@ def use_nonce(server_url, timestamp, salt)
ts = timestamp.to_s # base 10 seconds since epoch
nonce_key = key_prefix + 'N' + server_url + '|' + ts + '|' + salt
result = @cache_client.add(nonce_key, '', expiry(Nonce.skew + 5))
- return !!(result =~ /^STORED/)
+ if result.is_a? String
+ return !!(result =~ /^STORED/)
+ else
+ return result == true
+ end
end
def assoc_key(server_url, assoc_handle=nil)
@@ -87,7 +91,11 @@ def cleanup_associations
def delete(key)
result = @cache_client.delete(key)
- return !!(result =~ /^DELETED/)
+ if result.is_a? String
+ return !!(result =~ /^DELETED/)
+ else
+ return result == true
+ end
end
def serialize(assoc)

0 comments on commit 884881a

Please sign in to comment.
Something went wrong with that request. Please try again.