Skip to content

Instantly share code, notes, and snippets.

@prokizzle
Created February 7, 2015 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prokizzle/2428b72ee67034e6cb51 to your computer and use it in GitHub Desktop.
Save prokizzle/2428b72ee67034e6cb51 to your computer and use it in GitHub Desktop.
Redis Hash Example in Rails
class Account
def self.name(id)
account = $redis.hget("accounts", id)
if account.nil?
account = User.find_by(id: id).settings(:personal).account
$redis.hset("accounts", id, account)
end
return account
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment