diff --git a/app/services/cache_service.rb b/app/services/cache_service.rb index 1963b2f1dc..dc3a7fac0e 100644 --- a/app/services/cache_service.rb +++ b/app/services/cache_service.rb @@ -37,25 +37,31 @@ class CacheService # Rails' caching in views is called "Fragment Caching" and uses some slightly different logic. # Note: keys supplied here are actually prepended with "views/" under the hood. - def self.ams_all_taxons_key - "inject-all-taxons-#{CacheService.latest_timestamp_by_class(Spree::Taxon)}" + def self.ams_all_taxons + [ + "inject-all-taxons-#{CacheService.latest_timestamp_by_class(Spree::Taxon)}", + { skip_digest: true } + ] end - def self.ams_all_properties_key - "inject-all-properties-#{CacheService.latest_timestamp_by_class(Spree::Property)}" + def self.ams_all_properties + [ + "inject-all-properties-#{CacheService.latest_timestamp_by_class(Spree::Property)}", + { skip_digest: true } + ] end def self.ams_shops [ "shops/index/inject_enterprises", - { expires_in: SHOPS_EXPIRY } + { expires_in: SHOPS_EXPIRY, skip_digest: true } ] end def self.ams_shop(enterprise) [ "enterprises/shop/inject_enterprise_shopfront-#{enterprise.id}", - { expires_in: SHOPS_EXPIRY } + { expires_in: SHOPS_EXPIRY, skip_digest: true } ] end end diff --git a/app/views/layouts/darkswarm.html.haml b/app/views/layouts/darkswarm.html.haml index 3986d9ace8..fc282d5c6e 100644 --- a/app/views/layouts/darkswarm.html.haml +++ b/app/views/layouts/darkswarm.html.haml @@ -48,9 +48,9 @@ = inject_current_hub = inject_current_user = inject_rails_flash - - cache CacheService::FragmentCaching.ams_all_taxons_key do + - cache(*CacheService::FragmentCaching.ams_all_taxons) do = inject_taxons - - cache CacheService::FragmentCaching.ams_all_properties_key do + - cache(*CacheService::FragmentCaching.ams_all_properties) do = inject_properties = inject_current_order = inject_currency_config diff --git a/spec/features/consumer/caching/darkwarm_caching_spec.rb b/spec/features/consumer/caching/darkwarm_caching_spec.rb index 026039e686..e53f63ed32 100644 --- a/spec/features/consumer/caching/darkwarm_caching_spec.rb +++ b/spec/features/consumer/caching/darkwarm_caching_spec.rb @@ -33,10 +33,10 @@ feature "Darkswarm data caching", js: true, caching: true do visit shops_path taxon_timestamp1 = CacheService.latest_timestamp_by_class(Spree::Taxon) - expect_cached "views/#{CacheService::FragmentCaching.ams_all_taxons_key}" + expect_cached "views/#{CacheService::FragmentCaching.ams_all_taxons[0]}" property_timestamp1 = CacheService.latest_timestamp_by_class(Spree::Property) - expect_cached "views/#{CacheService::FragmentCaching.ams_all_properties_key}" + expect_cached "views/#{CacheService::FragmentCaching.ams_all_properties[0]}" toggle_filters @@ -54,10 +54,10 @@ feature "Darkswarm data caching", js: true, caching: true do visit shops_path taxon_timestamp2 = CacheService.latest_timestamp_by_class(Spree::Taxon) - expect_cached "views/#{CacheService::FragmentCaching.ams_all_taxons_key}" + expect_cached "views/#{CacheService::FragmentCaching.ams_all_taxons[0]}" property_timestamp2 = CacheService.latest_timestamp_by_class(Spree::Property) - expect_cached "views/#{CacheService::FragmentCaching.ams_all_properties_key}" + expect_cached "views/#{CacheService::FragmentCaching.ams_all_properties[0]}" expect(taxon_timestamp1).to_not eq taxon_timestamp2 expect(property_timestamp1).to_not eq property_timestamp2