Module: Compass::ConditionalCache

Extended by:
ActiveSupport::Concern
Included in:
MenuController, NotificationController
Defined in:
app/controllers/concerns/compass/conditional_cache.rb

Overview

Shared ETag sources and cache header helpers for Compass controllers.

Instance Method Summary collapse

Instance Method Details

#with_cache(items, config, etag:) ⇒ Object



19
20
21
22
23
24
25
# File 'app/controllers/concerns/compass/conditional_cache.rb', line 19

def with_cache(items, config, etag:)
  config ? expires_in(*Array(config)) : expires_now

  return unless stale? items, etag: etag

  yield
end