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

Remove Sonata Cache #1096

Closed
Tracked by #1416
core23 opened this issue Nov 30, 2019 · 13 comments
Closed
Tracked by #1416

Remove Sonata Cache #1096

core23 opened this issue Nov 30, 2019 · 13 comments
Milestone

Comments

@core23
Copy link
Member

core23 commented Nov 30, 2019

We should use symfony cache instead.

Even the doctrine cache was just deprecated in favor of symfony cache:
https://github.com/doctrine/DoctrineCacheBundle#deprecation-warning

@core23 core23 added the feature label Nov 30, 2019
@stale
Copy link

stale bot commented Jan 30, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@eerison
Copy link
Contributor

eerison commented Apr 22, 2022

@Hanmac
Copy link
Contributor

Hanmac commented Jun 30, 2022

I did some brain storming about Removing Sonata Cache(Bundle) from Page Bundle.

  • Block ESI Cache and Block SSI Cache use features more related to symfony http cache than symfony cache.
  • I think the change should be done in two parts:
    • Make Page Bundle use PSR-6 or PSR-16 Cache Interface to store rendered blocks if wanted. (What Cache PSR should be prefered?) Symfony Cache is only an implementation of these two.
    • Make the ESI/SSI Cache be able use the previous PSR-6/16 cached page content and wrap it into ESI/SSI

i don't know yet how it is controlled which pages/blocks are cached in which way.

I need to say that i didn't used page bundle yet, so that's just my thoughts of uninvolved.

@eerison
Copy link
Contributor

eerison commented Jun 30, 2022

I did some brain storming about Removing Sonata Cache(Bundle) from Page Bundle.

  • Block ESI Cache and Block SSI Cache use features more related to symfony http cache than symfony cache.

  • I think the change should be done in two parts:

    • Make Page Bundle use PSR-6 or PSR-16 Cache Interface to store rendered blocks if wanted. (What Cache PSR should be prefered?) Symfony Cache is only an implementation of these two.
    • Make the ESI/SSI Cache be able use the previous PSR-6/16 cached page content and wrap it into ESI/SSI

i don't know yet how it is controlled which pages/blocks are cached in which way.

I need to say that i didn't used page bundle yet, so that's just my thoughts of uninvolved.

what do you mean "Make Page Bundle uses PSR-6"? implement something or just make it uses : https://symfony.com/doc/current/components/cache.html#cache-contracts-versus-psr-6 ?

@Hanmac
Copy link
Contributor

Hanmac commented Jun 30, 2022

yeah that's another interface i could bind check.
I think we should prefer that one over the others because it has callbacks

@eerison
Copy link
Contributor

eerison commented Jun 30, 2022

yeah that's another interface i could bind check. I think we should prefer that one over the others because it has callbacks

if you prefer do this ticket in 2 part it's fine, I guess it's better to review :)

can you open a DRAFT pull request when you do something :)

@Hanmac
Copy link
Contributor

Hanmac commented Jul 1, 2022

one thing i didn't found yet, is it configurable what pages/blocks are cached and how long?

or should i try to add such option? (per page/block?)

@eerison
Copy link
Contributor

eerison commented Jul 1, 2022

one thing i didn't found yet, is it configurable what pages/blocks are cached and how long?

or should i try to add such option? (per page/block?)

I guess it's fine you add the option, if it's easiest for you :)

just remember that you need to add a default value for whom didn't add any configuration.

@Hanmac
Copy link
Contributor

Hanmac commented Jul 4, 2022

there is also https://twig.symfony.com/doc/3.x/tags/cache.html for doing caching of block/page segments

i need to understand the structure of block/page in sonata better, but in theory we could use symfony cache to check if a rendered block/page already exist, so no database is needed for blocks and pages with non static id?

then for some static blocks we could use twig cache too (if needed?)

and last thing we could add esi/ssi cache, which could use the symfony cached rendered data too.

For the symfony Cache, it shouldn't be a problem to invalidate the data over their tags.
For Twig Cache the recommendation suggest to use updated_at as part of the cache item id

otherwise it might be cleaner to remove the caching from this Bundle, and add it alter again via other features (above)

some checking in the code, there are some hard coded dependencies that can made into soft-coded ones (like disabling the cache manager) or not defining the services. PageBundle should work even without caching. We could try that first before removing Caching in Major version.

@eerison
Copy link
Contributor

eerison commented Jul 7, 2022

Remove cache part 1 was solved here: #1427 🥳

it's just missing remove the code from 4.x branch 😃

@Hanmac
Copy link
Contributor

Hanmac commented Jul 7, 2022

should i wait until SonataCI does merge 3.x into 4.x?

@Hanmac
Copy link
Contributor

Hanmac commented Jul 7, 2022

I did a PR for removing Cache in 4.x #1430

i can rebase the PR if needed

@jordisala1991
Copy link
Member

Yes, better to wait for the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants