Closed deevus closed 9 months ago
Hi! I did not really have a chance to test this cacheable repository on practice Do you use database to store the cart products ? As for cache flushing - it flushes after create/update/delete operations called from the service (it will trigger the repo method, and flush the cache inside repo function, see the screenshot) Also it`s a good point to make flush cache as a public function
I agree that the cache flushing methods should be public.
There should also be a way to propagate cache flushes across repositories.
@deevus I made cache flush function as public. Now you can access it within your repository or service
Hi there
This package has been a great quickstart on service/repositories in a new project. Thanks!
I'm concerned that the caching strategy out of the box is a bit half baked. Perhaps you have already solved such a problem before and I'm just not seeing the obvious solution. It's also possible that I should skip caching for this problem, since it is in userland and not global.
Let's say I have a
Cart
model, with associatedCartService
andCartRepository
classes. If I want to add aLineItem
to theCart
, I want to flush the cache so that the new line items are fetched on the next request.In domain driven design, the method
addToCart
would go on theCartService
class. However, this doesn't have access to cache flushing on theCartRepository
.Is the cached repository only meant for global objects (e.g. Products) and as such is a blunt instrument?
Appreciate your thoughts and thanks again for the package.