Created
October 14, 2016 04:05
-
-
Save shokai/c3a8f42bc075e9bb13c8c4a589d3f96b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'memcached' | |
cache = Memcached.new 'localhost:11211' | |
puts cache.set('user', 'shokai', 3) | |
puts cache.get('user') | |
sleep 3 | |
begin | |
puts cache.get('user') # should expire | |
rescue Memcached::NotFound => e | |
puts "user is expired (this is ok)" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment