-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Cache] Doc context aware adapters, aka hierarchical invalidation #6858
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
Conversation
cd6020f
to
95e7978
Compare
I'd happily accept any suggestions for making the explanations more detailed. It's hard to write doc when things seem obvious because you wrote the code... |
- expiration based invalidation for time related dependencies. | ||
|
||
.. versionadded:: 3.2 | ||
Tags and namespace based invalidation were introduced in Symfony 3.2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it should be "was" here, as it's refering to "X based invalidation", which is singular.
95e7978
to
bb34f3c
Compare
invalidation version number (conceptually similar to their latest invalidation | ||
date). When only one adapter is used, items and tags are all stored in the same | ||
place. By using two adapters, you can e.g. store some big cached items on the | ||
filesystem or in the database, and keep tags in a Redis database to sync all your |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the serial comma before "and keep"
Sorry, was distracted for some time during the review of this PR. I've now finished reviewing this article, thanks for documenting this feature! status: needs work |
How to configure tag aware cache using framework config? |
@Koc I don't know yet :) would need a PR on FrameworkBundle. |
…TagAwareRedisAdapter) (nicolas-grekas) This PR was merged into the 3.2-dev branch. Discussion ---------- [Cache] Add generic TagAwareAdapter wrapper (replaces TagAwareRedisAdapter) | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#6858 This PR replaces TagAwareRedisAdapter introduced in #19047 by a generic `TagAwareAdapter` that works with any two adapters. Commits ------- 288308b [Cache] Add generic TagAwareAdapter wrapper (replaces TagAwareRedisAdapter)
d30112d
to
f753506
Compare
// or invalidate all items related to `tag_1` or `tag_3` | ||
$cache->invalidateTags(array('tag_1', 'tag_3')); | ||
|
||
Of course when you know the cache key, it's better to call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would reword that this way:
Using Cache tags invalidation is very useful when you don't need to know the cache key to delete.
And I will mention $cache->deleteItem('cache_key');
in the previous example (self-explained).
WDYT ?
The docs is clear to me (non-native english). Big thanks to you @nicolas-grekas ! I want to play with this component now ^^ |
The Symfony Cache component provides three mechanisms to help solve this problem: | ||
|
||
* Tags based invalidation for managing data dependencies; | ||
* Namespace based invalidation for context dependend data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dependent
f753506
to
7fa65ac
Compare
Comments addressed, examples updated. More comments welcomed :) |
``Vary: User-Agent`` or ``Vary: Accept-Encoding`` HTTP headers:: | ||
|
||
$perUserAgentCache = $httpCache->fork($varyingUserAgent); | ||
$perAcceptEndoginPerUserAgentCache = $childCache->fork($varyingAcceptEncoding); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encoding
7fa65ac
to
e5e112f
Compare
This PR was merged into the 3.2-dev branch. Discussion ---------- [Cache] Add PDO + Doctrine DBAL adapter | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#6858 This PR adds a PDO adapter for our PSR-6 cache items. The implementation heavily borrows from PdoSessionHandler. Commits ------- 82a0de2 [Cache] Add PDO + Doctrine DBAL adapter
This PR was merged into the 3.2-dev branch. Discussion ---------- [Cache] Add PDO + Doctrine DBAL adapter | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#6858 This PR adds a PDO adapter for our PSR-6 cache items. The implementation heavily borrows from PdoSessionHandler. Commits ------- 82a0de2 [Cache] Add PDO + Doctrine DBAL adapter
Maybe it is just me but I am not quite understanding the "Namespaces"/"Forkable" feature. Perhaps a more extensive example? |
@kbond see https://www.drupal.org/developing/api/8/cache/contexts for another use case of this feat. Maybe one should first read this page then help me find the right words to explain the feat. ? :) |
e5e112f
to
2c31a64
Compare
2c31a64
to
9f775bb
Compare
* Expiration based invalidation for time related dependencies. | ||
|
||
.. versionadded:: 3.2 | ||
Tags and namespace based invalidation was introduced in Symfony 3.2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
were introduced
9f775bb
to
dd864d8
Compare
I just rewrote entirely this paragraph, any better? |
Much better now for me |
I'm understanding it much better as well. The example is great! |
Closing, see symfony/symfony#19521 (comment) |
…olas-grekas) This PR was merged into the master branch. Discussion ---------- [Cache] Add chapter about invalidation, tags, etc. This is a subpart of #6858 that tells only about merged features. Please merge asap so we can rebase #6858 on top and focus on its specific bits afterwards :) Commits ------- 0ffc261 [Cache] Add chapter about invalidation, tags, etc.
No description provided.