I am trying to figure out which layer should be responsible for the caching (insert/remove) work in a Domain Driven Design project. The goal is to improve performance of the Web Application by caching any entities that is retrieved from the repository.
My solution is separated as follows:
MyApp.Infrastracture
MyApp.Repositories
MyApp.Domain
MyApp.WebApplication
I feel that since it's only the Web Application that utilises the cache then it should be this layer that the caching logic should go? However this does not feel correct as i want to keep the web app lightweight and focused on serving web pages.
Also caching is not a first class domain concept so does not have a natural fit in the Domain layer.
What to do?
A cache repository is a storage location where Veeam Backup & Replication keeps temporary cached metadata for the data backed up by the file share backup jobs. For more information about cache repository, see NAS Backup Support.
Yes, repository implementations can definitely be a part of your domain model.
In computing, a cache is a high-speed data storage layer which stores a subset of data, typically transient in nature, so that future requests for that data are served up faster than is possible by accessing the data's primary storage location.
Application Layer: Mediates between the Presentation and Domain Layers. Orchestrates business objects to perform specific application tasks. Implements use cases as the application logic. Domain Layer: Includes business objects and the core (domain) business rules.
It is a concern of all of the above.
Caching is one of those cross cutting concerns that each layer needs to handle individually and the application needs to orchestrate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With