mostafaznv / nova-laracache

Nova LaraCache integrates the LaraCache package with Laravel Nova, providing a convenient tool to moderate and manage cache entities within the Laravel Nova.
MIT License
10 stars 1 forks source link

Caching Nova resource queries #10

Closed devnicolas1 closed 1 year ago

devnicolas1 commented 1 year ago

If I got it correctly, this package serves the purpose of creating a visual interface so we can interact with the cached results that we have. Thing is, in my team's case, we need a way of caching the queries that Nova does in a resource (for example, to show all of the resources, to show a specific resource, etc).

Is there any way of caching Nova's queries that I'm missing? Since I can't exactly define the queries in my model (since Nova build the queries themselves internally), I suppose it isn't that simple. My goal is to be able to load a resource page, caching the results and have the control over it that this package offers

Thanks for the awesome package anyway! :)

mostafaznv commented 1 year ago

Hi @devnicolas1, Thank you for using this package.

This package utilizes all the functionalities of Laracache. Laracache is another package of mine that simplifies caching model queries. In other words, it’s a tool to create, delete, update, and use a cached version of your predefined (this is an important note) queries.

Based on the provided descriptions, I think there isn’t a straightforward solution for your use case.

However, I believe you can implement it somehow. It’s a basic idea, but I think if you override the indexQuery method of your resources, you can update your cache entities there. If you want to feed your Nova resources with a cached version, it needs more customization. I have some raw ideas, but they require further refinement.

devnicolas1 commented 1 year ago

Thanks! I might try something related to this. I'll make sure to add any relevant info to this issue/through a PR in case it looks like something useful for others.

Thanks for the help!

mostafaznv commented 1 year ago

You're welcome. I'm going to close this issue. Feel free to reopen it.