Open patie opened 7 years ago
Yes nesting is possible, so the problem you face is related to the cache invalidation.
Obviously if you only invalidate the inner cache item, the parent cache item still is there.
So, your category
strategy should also invalidate the product
strategy.
so when i want invalidate inner/nested item i must invalidate all parents? no other way? not very good idea invalidate all products in category, because category url changed :)
That is the concept of caching I guess? Both the parent and child are not aware that they have an interrelated dependency.
One way to solve this, would be to group your cache items by tagging them, and invalidate using tags. Not all cache systems support tags though.
@rvanlaak i understand its concept of russian dolls caching, but im searching solution for solve this, tagging will be great, but i think in this library itsnt support for tagging and invalidating by tag, or im wrong?
You can use the PSR-6 adapter provided with this library, and for instance use Redis as that supports tags.
can you please show simple example with tagging for this library?
It would be a combination of using the Twig cache PSR-6 adapter and using a cache pool implementation adapter that supports tagging.
Although I did not implement tagging myself yet, it seems like all cache pools nowadays support tagging via the TagSupportWithArray
trait.
so must be implement, not work out of the box, ok
@patie please remember that this library is about twig caching, not about any business rules around cache invalidation using grouping by tag. As I probably am the only one reading this issue, I also think that posting your question on Stackoverflow will help you better, as it will get more exposure over there. 👍
no problem, im only asking, thank you :)
hi, its somehow possible something like this?
when i change category (i have own key generator, watching classname+id+updatedat, this is ok), i want change/regenerate only category block inside - but its not working for me, its possible to do this or i must regenerate top parent - product in this case? thanks