Skip to content

[FrameworkBundle] Add router.ignore_cache config option #53059

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

Okhoshi
Copy link
Contributor

@Okhoshi Okhoshi commented Dec 13, 2023

Q A
Branch? 7.1
Bug fix? no
New feature? yes
Deprecations? no
Issues none
License MIT

In #52962, the router.cache_dir is marked as deprecated, but no replacement was given for the specific case when one wants to completely disable the router cache (use to be done by setting router.cache_dir to ~ or null).

This MR introduces router.ignore_cache option to restore that possibility, while still deprecating the choice of cache location.

@carsonbot carsonbot added this to the 7.1 milestone Dec 13, 2023
@Okhoshi Okhoshi changed the title [FrameworkBundle] Add config option [FrameworkBundle] Add router.ignore_cache config option Dec 13, 2023
@Okhoshi Okhoshi force-pushed the framework-router-ignore-cache branch from a77c708 to 798b131 Compare December 13, 2023 15:25
@Okhoshi Okhoshi force-pushed the framework-router-ignore-cache branch from 798b131 to af9127f Compare January 5, 2024 08:33
OskarStark added a commit to symfony/symfony-docs that referenced this pull request Jan 9, 2024
This PR was merged into the 7.1 branch.

Discussion
----------

[FrameworkBundle] Update `cache_dir` config

Update the documentation on configuration of the FrameworkBundle to reflect the deprecation of `cache_dir` (done in symfony/symfony#52962) and the introduction of `ignore_cache` (from symfony/symfony#53059).

Fixes #19281

Ping `@alexandre`-daubois

Commits
-------

47e0be0 [FrameworkBundle] Update cache_dir config
@Okhoshi Okhoshi force-pushed the framework-router-ignore-cache branch 2 times, most recently from 86fb594 to 88a7ef4 Compare January 9, 2024 22:01
@OskarStark
Copy link
Contributor

@nicolas-grekas I accidentaly merged symfony/symfony-docs#19399

Shall I revert or is PR ready to merge from your side?

Thanks

cc @xabbuh

@Okhoshi Okhoshi force-pushed the framework-router-ignore-cache branch from 88a7ef4 to 1b9df2c Compare March 23, 2024 20:26
Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
@Okhoshi Okhoshi force-pushed the framework-router-ignore-cache branch from 1b9df2c to 7d538db Compare March 23, 2024 21:53
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

Why would anyone want to disable the router cache?

@@ -13,6 +13,7 @@ CHANGELOG
* Add `secrets:reveal` command
* Add `rate_limiter` option to `http_client.default_options` and `http_client.scoped_clients`
* Attach the workflow's configuration to the `workflow` tag
* Add `router.ignore_cache` config option
Copy link
Member

Choose a reason for hiding this comment

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

no_cache?

@@ -619,8 +619,9 @@ private function addRouterSection(ArrayNodeDefinition $rootNode): void
->scalarNode('type')->end()
->scalarNode('cache_dir')
->defaultValue('%kernel.build_dir%')
->setDeprecated('symfony/framework-bundle', '7.1', 'Setting the "%path%.%node%" configuration option is deprecated. It will be removed in version 8.0.')
->setDeprecated('symfony/framework-bundle', '7.1', 'Setting the "%path%.%node%" configuration option is deprecated. It will be removed in version 8.0. Please use the "ignore_cache" option if you want to ignore the cache in the router.')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
->setDeprecated('symfony/framework-bundle', '7.1', 'Setting the "%path%.%node%" configuration option is deprecated. It will be removed in version 8.0. Please use the "ignore_cache" option if you want to ignore the cache in the router.')
->setDeprecated('symfony/framework-bundle', '7.1', 'Setting the "%path%.%node%" configuration option is deprecated. It will be removed in version 8.0. Use the "no_cache" option if you want to disable the router cache.')

@Okhoshi
Copy link
Contributor Author

Okhoshi commented Apr 3, 2024

Why would anyone want to disable the router cache?

I don't know, but it was a supported scenario until cache option was deprecated. If you think it is not useful, I can also deprecate that feature as well.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Apr 3, 2024

It is already deprecated, isn't it? I'm calling for use cases that need to disable the cache. We can merge this PR in a later version if people report that they cannot work around the deprecation while they need to disable the cache.

@Okhoshi
Copy link
Contributor Author

Okhoshi commented Apr 3, 2024

Then I'll remove the part regarding this option in the doc.

Should I close this PR now ? I can still reopen it or redo the code changes if needed in the future.

@nicolas-grekas
Copy link
Member

Yep, let's close and wait for feedbacks.

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Apr 4, 2024
…ache` option (Okhoshi)

This PR was merged into the 7.1 branch.

Discussion
----------

[FrameworkBundle] Remove mention of inexistant `ignore_cache` option

The `ignore_cache` option was introduced in the documentation in #19399, but was not introduced in the code and will not be in the 7.1 release (see symfony/symfony#53059 for more details).

Commits
-------

f68defc [FrameworkBundle] Remove mention of inexistant `ignore_cache` option
@Okhoshi Okhoshi deleted the framework-router-ignore-cache branch June 30, 2024 16:18
@mpdude
Copy link
Contributor

mpdude commented Jul 4, 2024

👋🏼 It's me, I want to disable the cache and I added the initial support for this configuration setting (explicitly mentioning the ~/null use case).

The reason is that I have test suites where different sets of routes need to be loaded. IIRC, the router keeps the routes in a private static property, and so tests fail once one set of routes has been loaded. Disabling the cache dir was one way to prevent this caching.

What can I do to keep this possibility open?

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.

5 participants