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

Cache setLink in Canonical #2887

Closed
wants to merge 2 commits into from
Closed

Conversation

bobdenotter
Copy link
Member

@bobdenotter bobdenotter commented Oct 26, 2021

Split out part of #2853

Note: This breaks stuff if you change the bolt.backend_url in services.yaml.

We'll need to somehow detect changes in config, and call $this->cache->invalidateTags(['routes']);

src/Canonical.php Outdated Show resolved Hide resolved
$cacheKey = 'bolt.generateLink_' . md5($route . implode('-', $params) . (string) $canonical);

$link = $this->cache->get($cacheKey, function (ItemInterface $item) use ($route, $params, $canonical) {
$item->tag('routes');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bobdenotter I see these popping up in a few places now. Should we create an enum-type class like that?

https://github.com/bolt/core/blob/master/src/Enum/UserStatus.php

Especially since it could be that extensions also may need to clear cache after performing some operations?

Leaving it here as a general comment for all relate PRs 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good idea! I'll do this in a separate PR, though.

@bobdenotter
Copy link
Member Author

Closed in favor of #2980

@I-Valchev I-Valchev deleted the Cache-setLink-in-Canonical branch November 29, 2021 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants