8000 Newly added CacheInterface::get() method does not expose the lifetime in case of item recomputation · Issue #27732 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Newly added CacheInterface::get() method does not expose the lifetime in case of item recomputation #27732

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
pounard opened this issue Jun 26, 2018 · 4 comments
Labels

Comments

@pounard
Copy link
Contributor
pounard commented Jun 26, 2018

llowing issue #27604 where @nicolas-grekas, I have a tiny question: since that #27604 introduces it in documentation saying:

added CacheInterface, which provides stampede protection via probabilistic early expiration and should become the preferred way to use a cache

I'm OK with using it, but since I can't expose any lifetime, default will be infinite or whatever the adapter decides for all caches that are set using this method.

Is there a reason for that ?

@pounard
Copy link
Contributor Author
pounard commented Jun 26, 2018

Actually, I'm stupid, the callback is supposed the get the cache item from its signature, it's this item that should be changed.

Wouldn't it break immutability, shouldn't the callback return the modified item instead of modifying the existing one ?

@stof
Copy link
Member
stof commented Jun 26, 2018

CacheItem in PSR-6 is not immutable.

@pounard
Copy link
Contributor Author
pounard commented Jun 26, 2018

I didn't caught that, thanks for the answer, I guess it answers my question then.

@pounard pounard closed this as completed Jun 26, 2018
@nicolas-grekas
Copy link
Member

yep, thats exactly why the item is passed as argument: to add lifetime, tags, etc

@xabbuh xabbuh added the Cache label Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
0