Skip to content

Cache setLink in Canonical#2887

Closed
bobdenotter wants to merge 2 commits intomasterfrom
Cache-setLink-in-Canonical
Closed

Cache setLink in Canonical#2887
bobdenotter wants to merge 2 commits intomasterfrom
Cache-setLink-in-Canonical

Conversation

@bobdenotter
Copy link
Copy Markdown
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']);

Comment thread src/Canonical.php Outdated
Comment thread src/Canonical.php
$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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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