Skip to content
Create a gist now

Instantly share code, notes, and snippets.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.