Once a change is made (for example an Artist is updated or a new Artist is added) you have these options:
The last method is the simplest and also the preferred way. Note that the cache will refill automatically through the lazy loading mechanism.
The first method should only be used if your cache is very large and/or frequent updates take place (essentially you want to avoid frequent large database selects). If you choose to use method 1. then remember to place locks around the critical code to maintain thread safety.
By the way: you can add the extra code that interacts with the cache in your code behind or (even better) in the service layer.
There is no need move it to the Domain project because caching here is rather application specific. (I would only move it to the Domain project if caching were a cross-cutting concern in which you wish to automatically cache just about all tables. In that case there are probably better 3rd party solutions to do that).
Hope this helps.
Jack Poorte, Sep 26, 2013
Thanks for taking the time to reply but I still don't know what the design has to do with cloud? What makes this app "portable" to the could? The n-tier design or the actual service? Thanks
Jul 25, 2012