Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rails.cache.write('temp',Date.today,:expires_in => 60.seconds)
- config.action_controller.perform_caching = true
- config.cache_store = :memory_store
- if expires_in > 0 && !options[:raw]
- # Set the memcache expire a few minutes in the future to support race condition ttls on read
- expires_in += 5.minutes
- end
- output_json = Rails.cache.fetch('temp',expires_in: 1.minute,race_condition_ttl:3) do
- my_expansive_operation().to_json
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement