public
Created

  • Download Gist
user.rb
Ruby
1 2 3 4 5 6 7 8 9
def cache_user(userid)
if user = get("current_user_#{userid}")
return user
else
user = User.first(:id => userid)
set("current_user_#{userid}", user, 3600)
return user
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.