Skip to content

Instantly share code, notes, and snippets.

@jarod022
Last active March 22, 2017 17:11
Show Gist options
  • Save jarod022/6d407f388183b0a3c730abaf8c4eaee3 to your computer and use it in GitHub Desktop.
Save jarod022/6d407f388183b0a3c730abaf8c4eaee3 to your computer and use it in GitHub Desktop.
Rails: how to save up database queries using cache
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