Skip to content

Instantly share code, notes, and snippets.

@catchthecows
Created October 29, 2010 23:20
Show Gist options
  • Save catchthecows/654642 to your computer and use it in GitHub Desktop.
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.
#!/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