Created
July 12, 2013 19:28
-
-
Save sapienza/5987088 to your computer and use it in GitHub Desktop.
Rails and Memcache. Different Cached Scopes for each user.
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
| def self.cached_scope_for_user(user_id) | |
| Rails.cache.fetch "scope_for_user_#{user_id}" do | |
| results = Model.where("user_id = ?)", user_id) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment