lib/wcc/contentful/middleware/store/caching_middleware.rb in wcc-contentful-1.4.0.rc3 vs lib/wcc/contentful/middleware/store/caching_middleware.rb in wcc-contentful-1.4.0

- old
+ new

@@ -20,12 +20,14 @@ def find(key, **options) event = 'fresh' found = @cache.fetch(key, expires_in: expires_in) do event = 'miss' - # if it's not a contentful ID don't hit the API. + # if it's from the sync engine don't hit the API. + next if key =~ /^sync:/ + # Store a nil object if we can't find the object on the CDN. - (store.find(key, **options) || nil_obj(key)) if key =~ /^\w+$/ + (store.find(key, **options) || nil_obj(key)) end return unless found return if %w[Nil DeletedEntry DeletedAsset].include?(found.dig('sys', 'type'))