spiritix / lada-cache

A Redis based, fully automated and scalable database cache layer for Laravel
MIT License
538 stars 68 forks source link

"exclude-tables" configuration not working and throwing error #122

Open abishekrsrikaanth opened 1 year ago

abishekrsrikaanth commented 1 year ago

I am using Spatie's MediaLibrary and when I reference the trait to cache a Model that uses the HasMedia Interface and InteractsWithMedia trait, any queries to that model fails to work. This is because the LadaCacheTrait is not used on the MediaLibrary package referenced above. To go around this, if I understand correctly, there is a configuration on the config file to exclude the table. So I update the config to the following

 'exclude-tables' => [
        (new \Spatie\MediaLibrary\MediaCollections\Models\Media())->getTable()
    ],

this doesn't seem to have any effect and the error persists. My understanding from what I see on the readme is that this package should ignore queries that are excluded in the above config.

Error Message

Spiritix\LadaCache\QueryHandler::setBuilder(): Argument #1 ($builder) must be of type Spiritix\LadaCache\Database\QueryBuilder, Illuminate\Database\Query\Builder given

Any reason why this config isn't working?

Version Information

Laravel: v10.22.0 PHP: v8.2 Lada-Cache: Version: v5.3

spiritix commented 1 year ago

That's a known issue with thirdparty packages, see here for a possible solution: https://github.com/spiritix/lada-cache/issues/99#issuecomment-1017250267