renoki-co/laravel-eloquent-query-cache

Don't use cache depends on config

quevlu opened this issue · 7 comments

Hi, thanks for your time for this great package. I've been searching for closed issues and PRS, but I didn't find any related to what I want to do. Is there any possibility to prevent the use of cache with a config file?

You can cache queries individually if this is what you want: https://leqc.renoki.org/cache-tags/query-caching#enable-disable-caching-on-demand

@rennokki Yes, but It's not the goal that I would like to get. It doesn't allow me to disable cache via config.

I get the point, but why would you want to enable/disable the cache at the config level (per entire app)? I want to know the use case you're facing.

I've had some problems with test cases

You might want to delete the entire cache before each test using the PHPunit's setUp() method? Or within the tests?

You can use these code in each of your models to implement your requirement:

if (config('your.config.usecache')) {
    use QueryCacheable;
}
stale commented

This issue has been automatically closed because it has not had any recent activity. 😨