Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Add documentation about RedisTagAwareAdapter#14081
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -188,6 +188,20 @@ Available Options | ||||||
| When using the `Predis`_ library some additional Predis-specific options are available. | ||||||
| Reference the `Predis Connection Parameters`_ documentation for more information. | ||||||
| .. _redis-tag-aware: | ||||||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||
| Working with Tags | ||||||
| ----------------- | ||||||
| In order to use tag-based invalidation, you can wrap your adapter in :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter`, but when Redis is used as backend, it's often more interesting to use the dedicated :class:`Symfony\\Component\\Cache\\Adapter\\RedisTagAwareAdapter`. Since tag invalidation logic is implemented in Redis itself, this adapter offers better performance when using tag-based invalidation:: | ||||||
| use Symfony\Component\Cache\Adapter\RedisAdapter; | ||||||
| use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter; | ||||||
| $client = RedisAdapter::createConnection('redis://localhost'); | ||||||
| $cache = new RedisTagAwareAdapter($client); | ||||||
| .. _`Data Source Name (DSN)`: https://en.wikipedia.org/wiki/Data_source_name | ||||||
| .. _`Redis server`: https://redis.io/ | ||||||
| .. _`Redis`: https://github.com/phpredis/phpredis | ||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -58,6 +58,10 @@ To store tags, you need to wrap a cache adapter with the | ||||||||
| :method:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapterInterface::invalidateTags` | ||||||||
| method. | ||||||||
| .. note:: | ||||||||
| When using a Redis backend, consider using :ref:`RedisTagAwareAdapter <redis-tag-aware>` which is optimized for this purpose. | ||||||||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||||
| The :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter` class implements | ||||||||
| instantaneous invalidation (time complexity is ``O(N)`` where ``N`` is the number | ||||||||
| of invalidated tags). It needs one or two cache adapters: the first required | ||||||||