I've got an app that implements a command object pattern to get data from a server. Now I'd like to implement a client side cache and I need some pointers on how to deal with cache eviction invalidating.
The problem
To get an object I pass the GetObject(id) command and receieve a GetObjectResponse with the results for that id. I've got a cache going that can cache the GetObject(id) command nicely.
However, when I see a command like DeleteObject(id) or UpdateObject(id), the cache for GetObject(id) needs to be invalidated.
I should say that the reality is not necessarily this simple as with a single id parameter. Some response objects depend on more than one parameter in the command object. Also, passing one command object could invalidate more than one response objects.
Any thoughts on how to accomplish this? Thanks in advance!