Last active
March 22, 2017 17:11
-
-
Save jarod022/6d407f388183b0a3c730abaf8c4eaee3 to your computer and use it in GitHub Desktop.
Rails: how to save up database queries using cache
This file contains 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 SettingsCacher < GenericCacher | |
private | |
def cache_key | |
'global_settings' | |
end | |
def subject | |
Setting.all.load | |
end | |
def location | |
'/tmp/cache/query_caching/' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment