Skip to content

Instantly share code, notes, and snippets.

@imouaddine
Created August 30, 2018 17:10
Show Gist options
  • Save imouaddine/424e8ecb0acf3c770042ec04e5073a5a to your computer and use it in GitHub Desktop.
Save imouaddine/424e8ecb0acf3c770042ec04e5073a5a to your computer and use it in GitHub Desktop.
def fetch_events(start, end, timezone)
Rails.cache.fetch(cache_key, expires_in: 1.hour.from_now) do
GoogleClient.fetch_events
end
end
def cache_key
[
start,
end,
timezone,
current_user.cache_key,
].join("-")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment