Skip to content
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

expires tag #14969

Merged
merged 9 commits into from
May 27, 2024
Merged

expires tag #14969

merged 9 commits into from
May 27, 2024

Conversation

timkelty
Copy link
Contributor

@timkelty timkelty commented May 10, 2024

Description

Adds a expires tag for easier Twig access to \Craft::$app->getResponse()->setCacheHeaders.

// Cache-Control: public, max-age=1814400
{% expires in 3 weeks %}

// Cache-Control: public, max-age=30
{% expires on now|date_modify('+30 seconds') %}

// Cache-Control: no-cache, no-store, must-revalidate
{% expires %}

Based on 4.10 as it is useful for Cloud, but could be rebased to 5.x.

For no-cache, I went with just {% expires %} vs {% expires now %}, as it seemed like with now, we should support more relative times like tomorrow.

@timkelty timkelty force-pushed the feature/cache-response-tag branch from b56d22f to b28f4cb Compare May 10, 2024 03:27
@timkelty timkelty changed the title cacheResponse tag expires tag May 25, 2024
@brandonkelly brandonkelly merged commit fd721ca into 4.10 May 27, 2024
@brandonkelly brandonkelly deleted the feature/cache-response-tag branch May 27, 2024 22:38
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

Successfully merging this pull request may close these issues.

None yet

2 participants