caching_concern.rb 429 B

12345678910111213
  1. # frozen_string_literal: true
  2. module Api::CachingConcern
  3. extend ActiveSupport::Concern
  4. def cache_if_unauthenticated!
  5. expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless user_signed_in?
  6. end
  7. def cache_even_if_authenticated!
  8. expires_in(5.minutes, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless limited_federation_mode?
  9. end
  10. end