Skip to content
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

Use psr/cache for result caching #4620

Merged
merged 1 commit into from Apr 29, 2021

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Apr 27, 2021

Q A
Type feature
BC Break no
Fixed issues N/A

Summary

The Doctrine Cache library has served us well, but it's currently being phased out. This PR proposes to rely on PSR-6 for caches. Symfony Cache is used for PHPUnit tests, but PSR-6 should allow us to plug in any application's favorite caching solution easily.

@derrabus derrabus force-pushed the improvement/psr-cache branch 2 times, most recently from a8657a0 to 45f19e0 Compare April 27, 2021 07:43
Copy link
Member

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

Please document the deprecations in UPGRADE.md

src/Cache/QueryCacheProfile.php Outdated Show resolved Hide resolved
src/Configuration.php Outdated Show resolved Hide resolved
@derrabus
Copy link
Member Author

I've addressed your comments. No idea why the OCI8 jobs are failing suddenly, but the failures look unrelated.

@greg0ire
Copy link
Member

@greg0ire
Copy link
Member

Reported at shivammathur/setup-php#449

composer.json Show resolved Hide resolved
phpstan.neon.dist Show resolved Hide resolved
@alcaeus
Copy link
Member

alcaeus commented Apr 29, 2021

Given that ORM 2.9 won't support DBAL 3.x, are there any chances of backporting this into 2.x?

@derrabus
Copy link
Member Author

Given that ORM 2.9 won't support DBAL 3.x, are there any chances of backporting this into 2.x?

It probably won't be hard to do this, but do we need to? Are DBAL and ORM sharing any caches?

@alcaeus
Copy link
Member

alcaeus commented Apr 29, 2021

It probably won't be hard to do this, but do we need to? Are DBAL and ORM sharing any caches?

Depending on the timeline for DBAL 3 support in ORM 2, we don't need to. If that takes a while, I'd be in favour of backporting.

@alcaeus
Copy link
Member

alcaeus commented Apr 29, 2021

On a different note, with DBAL 3 supporting PHP 7.3+ but ORM 2 supporting 7.1+, there will be a number of users using ORM 2 that can't use DBAL 3. This will slow down the process of getting everybody off doctrine/cache 1.x.

@derrabus
Copy link
Member Author

@alcaeus Doctrine Cache 2 on DBAL 2 is easily possible without backporting these changes: #4623

UPGRADE.md Outdated Show resolved Hide resolved
@derrabus derrabus force-pushed the improvement/psr-cache branch 3 times, most recently from 22ffbc6 to aefa1a9 Compare April 29, 2021 15:21
@derrabus derrabus changed the title Deprecate doctrine/cache in favor of psr/cache Use psr/cache for result caching Apr 29, 2021
@derrabus
Copy link
Member Author

Follow-up for the deprecation warnings: #4624

@greg0ire
Copy link
Member

One question through: We could already soft-deprecate those methods by adding the @deprecated annotations, right? I would only remove the triggers, correct?

I don't have a religion on this, since it's probably only going to have an effect on the dev env. It would make sense to keep them so that people can already notice they should migrate something. @alcaeus WDYT?

@alcaeus
Copy link
Member

alcaeus commented Apr 29, 2021

If we deprecate them, we should also emit deprecation notices. I'm fine with deferring the deprecation itself to a future release.

@morozov
Copy link
Member

morozov commented Apr 29, 2021

What version is it planned to be released in? There's currently no 3.2.0 milestone but dependency changes and new deprecations don't get usually introduced in a patch. Somebody, please create a new milestone if necessary.

@greg0ire
Copy link
Member

Oh right 3.2.x does not even exist at this point, let me fix that.

@greg0ire greg0ire changed the base branch from 3.1.x to 3.2.x April 29, 2021 17:46
@greg0ire greg0ire added this to the 3.2.0 milestone Apr 29, 2021
@greg0ire greg0ire requested a review from morozov April 29, 2021 17:52
@derrabus
Copy link
Member Author

What version is it planned to be released in? There's currently no 3.2.0 milestone but dependency changes and new deprecations don't get usually introduced in a patch. Somebody, please create a new milestone if necessary.

Right. I've targeted the 3.1.x branch because there was no 3.2.x yet. This change definitely deserves a minor version bump.

@greg0ire greg0ire merged commit 37c9043 into doctrine:3.2.x Apr 29, 2021
@greg0ire
Copy link
Member

Thanks @derrabus !

@derrabus derrabus deleted the improvement/psr-cache branch April 29, 2021 20:06
@derrabus derrabus mentioned this pull request May 14, 2021
if ($resultCache instanceof CacheItemPoolInterface) {
$this->resultCache = $resultCache;
} elseif ($resultCache instanceof Cache) {
$this->resultCache = CacheAdapter::wrap($resultCache);
Copy link
Member

Choose a reason for hiding this comment

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

@derrabus my team just stumbled upon this, this is a BC Break I'm afraid, if the cache key contains reserved characters.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you elaborate? Or better, can you open an issue so we can discuss the BC break an possible solutions?

Copy link
Member

@greg0ire greg0ire Nov 29, 2021

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@derrabus sorry, didn't notice your message. I will open an issue.

Copy link
Member

Choose a reason for hiding this comment

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

See #5051

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants