Closed iveliniliev90 closed 3 years ago
Hi, could you share .json file that generates debugbar?
I need to understand what generate so many queries.
in nova index EVERY row generate same toTree and if you have a big tree... that's the result... a very slow index.
Hi, added simple cache in 1.4.2 version, that does not solve the problem of large trees, but solves the problem of multiple queries on one page.
Hmm, I'm using laravel-eloquent-query-cache and when I update the model that has parent which uses nodetrait in Nova it doesn't update the information but in database it's ok.
I suppose that when I enabled caching with redis, this cache implementation was automatically cached and is never cleared.
If I disable caching by setting cacheFor to 0 everything works
protected static bool $flushCacheOnUpdate = true;
public int $cacheFor = 3600;
is it possible to clear the cache? Some kind of tag or something so that when user saves the child that belongs to nested model it is udated in nova backend?
@eboye - Well... For relation belongsTo used mechanism with disable EventDispatcher and enable it after save. This is necessary to prevent an endless loop of events and this is cause of problem.
Need to think about how organize cache invalidation
At the end I made the observer of the product model and on saving event I added flushQueryCache()
/**
* Handle the Product "saving" event.
*
* @param Product $product
*
* @return void
*/
public function saving( Product $product ) {
$product->flushQueryCache();
}
Just a note for anyone else having the same issue as I did.
@eboye - Hi, added fix for package laravel-eloquent-query-cache in version 1.8.0.
Awesome! Thank you. I'll definitely try it and report back.
Hello! I try to use NestedTreeAttachManyField with belongsTo relations but....
can you fix this please.