-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Cache] Allow ISO 8601 time intervals to specify default lifetime #38253
Conversation
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
As this is a new feature, this should be based on master. |
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.
It would be great to allow using regular strings also, via e.g. strtotime('5 seconds', 0)
@lstrojny Can you take Nicolas's comment into account; we will close 5.2 for new feature tomorrow, would be great to have this one in. |
@fabpot @nicolas-grekas while working on the issue I found a bug with how the prefix seed is handled. Because the prefix seed is hashed before setting it as a constructor argument, env variables will not be properly handled. In fact what gets hashed is the Questions:
|
I'd prefer not adding a runtime factory for this. |
@nicolas-grekas unfortunately not, the compile time resolving is broken and additionally only resolving at compile time leads to unexpected results, where one would expect to pass a different env value for the seed and it‘s not picked up |
If it's broken ("broken" to be defined) we should fix it. Computing the seed (aka the namespaces of the pools) at runtime is not supported and shoudln't be IMHO. There are many config options that are not compatible with runtime configuration, this is one of them (although this one is compatible with compile time evaluation, which is not the case for many options). Reconsidering this is another story, not for this PR at least. |
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
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 rebased on master, removed the part about the seed, and made some minor CS tweaks)
Thank you @lstrojny. |
Psr\Cache\CacheItemInterface::expiresAfter()
takesDateInterval
for expiration but Symfony’s cache config only takes an integer. Time intervals are a bit better to read so this adds the capability.