Skip to content

Add a no-op cache tag #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bcdickinson opened this issue Mar 20, 2024 · 0 comments
Open

Add a no-op cache tag #245

bcdickinson opened this issue Mar 20, 2024 · 0 comments

Comments

@bcdickinson
Copy link

Is your proposal related to a problem?

Cache-related template tag's like Django's {% cache %} and Wagtail's {% wagtailcache %} and {% wagtailpagecache %} work by attempting to render a cached fragment, falling back to rendering the child nodes and storing the result in the cache.

When viewing patterns in the pattern library, particularly during local development, this is not what you want. You want to be able to instantly view changes made to the template. Additionally, context required to generate cache keys, such as page.cache_key in the case of {% wagtailpagecache %} may not be present in the pattern library context.

Describe the solution you'd like

I propose the DPL should have a no-op tag that unconditionally renders it's children and the ability to specify by name the tags that should be replaced with the no-op tag implementation in pattern library contexts. Config for this might look something like the following:

PATTERN_LIBRARY = {
    ...,
    "NOOP_CACHE_TAG_NAMES": ["cache", "wagtailcache", "wagtailpagecache"],
}

Maybe ["cache"] should be the default value for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant