Created
February 7, 2015 10:59
-
-
Save prokizzle/2428b72ee67034e6cb51 to your computer and use it in GitHub Desktop.
Redis Hash Example in Rails
This file contains hidden or 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
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