coderedcorp / wagtail-cache

A simple page cache for Wagtail based on the Django cache middleware.
Other
87 stars 29 forks source link

PicklingError for SampleStreamBlockMeta #34

Open vladox opened 2 years ago

vladox commented 2 years ago

We are getting the following error, is it a known issue?

_pickle.PicklingError: Can't pickle <class 'wagtail.core.blocks.base.SampleStreamBlockMeta'>: attribute lookup SampleStreamBlockMeta on wagtail.core.blocks.base failed

vladox commented 2 years ago

How do you avoid caching in the Wagtail API? The issue is with an APIView, but I couldn't find a way for the middleware to ignore the API Calls.

vsalvino commented 2 years ago

Good question. For the pickling error, what version of Wagtail and Django are you using?

As far as not caching the API, you'll need to disable the middleware, and either:

See this section in the docs: https://docs.coderedcorp.com/wagtail-cache/getting_started/install.html#only-cache-specific-views

Let me know if either of those approaches helps.

Hint while debugging: the HTTP Response contains an X-Wagtail-Cache header which indicates: skip, miss, or hit. If it is not present in the response then the URL is not even being touched by wagtail-cache.