Created
October 29, 2010 23:20
-
-
Save catchthecows/654642 to your computer and use it in GitHub Desktop.
Testing gist on tumblr with this nifty hash is a cache bit of code.
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
#!/usr/bin/ruby | |
@users = Hash.new do |cache, user_id| | |
data = "NEW" | |
cache[user_id] = data | |
puts "created #{user_id}" | |
end | |
test = @users[10] | |
test = @users[20] | |
test = @users[10] | |
test = @users[30] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment