-
-
Save benburkert/653 to your computer and use it in GitHub Desktop.
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
# current code: | |
unless @users = cache_get("active_users") | |
@users = User.all(:active => true) | |
cache_set("active_users", @users) | |
# object caching can be used to avoid pulling huge amounts of data | |
# from the database. | |
# you could have calle cache_set with an expiration time as well: | |
# cache_set("active_users", @users, 10) | |
end | |
# my suggestion: | |
@users = get_cache("active_users") do | |
User.all(:active => true) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment