8000 [FrameworkBundle] alias `cache.app.taggable` to `cache.app` if using `cache.adapter.redis_tag_aware` by kbond · Pull Request #44673 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] alias cache.app.taggable to cache.app if using cache.adapter.redis_tag_aware #44673

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

Closed
wants to merge 1 commit into from

Conversation

kbond
Copy link
Member
@kbond kbond commented Dec 16, 2021
Q A
Branch? 6.1
Bug fix? no
New feature? yes
Deprecations? no
Tickets n/a
License MIT
Doc PR n/a

When using cache.adapter.redis_tag_aware for your cache.app, cache.app.taggable is unnecessarily decorated.

@kbond kbond force-pushed the cache-app-redis-tag-aware branch from e4077bb to 9676bd6 Compare December 16, 2021 18:12
@nicolas-grekas
Copy link
Member

Isn't that a bugfix?

@@ -37,9 +36,6 @@
->public()
->tag('cache.pool', ['clearer' => 'cache.app_clearer'])

->set('cache.app.taggable', TagAwareAdapter::class)
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer keeping this definition as is

Copy link
Member Author

Choose a reason for hiding this comment

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

And just change to an alias if applicable in the extension?

Copy link
Member

Choose a reason for hiding this comment

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

Yes

@@ -2103,6 +2103,15 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
'tags' => false,
];
}

if ('cache.adapter.redis_tag_aware' === $config['app']) {
Copy link
Member

Choose a reason for hiding this comment

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

In theory, any pool can inherit from redis_tag_aware and require making cache.app an alias

Copy link
Member Author
@kbond kbond Dec 16, 2021

Choose a reason for hiding this comment

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

If I understand you correctly, the same could be said for the non-app cache pools below, correct? (cache.adapter.redis_tag_aware is hard-coded)

Copy link
Member

Choose a reason for hiding this comment

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

absolutely, recursively also, since pools can derivate from other pools.

Copy link
Member Author
@kbond kbond Dec 16, 2021

Choose a reason for hiding this comment

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

Ultimately, I don't think there shouldn't be any redis-specific check here at all. As discussed in slack, we should be using a pass to determine if the adapter used is already tag aware and alias/decorate based on that.

What do you think about matching what we do for custom pools now for 5.3 as a bug fix, then adding a more robust system in 6.1?

Copy link
Member

Choose a reason for hiding this comment

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

but the alias is created in the DI extension - the pass doesn't know about them

Copy link
Member Author

Choose a reason for hiding this comment

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

Think I finally understand and I believe #44682 solves.

@kbond
Copy link
Member Author
kbond commented Dec 16, 2021

Isn't that a bugfix?

I was in doubt so I called this a feature. Target 5.3 and call it a bug fix?

@nicolas-grekas
Copy link
Member

Wrapping a tagaware in a tagaware looks like a bug to me :)

@kbond
Copy link
Member Author
kbond commented Dec 17, 2021

Closing in favour of #44682.

@kbond kbond closed this Dec 17, 2021
@kbond kbond deleted the cache-app-redis-tag-aware branch December 17, 2021 00:17
nicolas-grekas added a commit that referenced this pull request Dec 17, 2021
…` if using `cache.adapter.redis_tag_aware` (kbond)

This PR was merged into the 5.3 branch.

Discussion
----------

[FrameworkBundle] alias `cache.app.taggable` to `cache.app` if using `cache.adapter.redis_tag_aware`

| Q             | A
| ------------- | ---
| Branch?       | 5.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

When using `cache.adapter.redis_tag_aware` for your `cache.app`, `cache.app.taggable` is unnecessarily decorated with `TagAwareAdapter`. This sets `cache.app.taggable` as an alias to `cache.app` in this case.

Alternative to #44673.

Commits
-------

4b54aa0 alias `cache.app.taggable` to `cache.app` if using `cache.adapter.redis_tag_aware`
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.

3 participants
0