Namely, B should listen to events that affect it's liveness, in this case the state of A A Map is a pretty natural abstraction for a cache and this is how Oracle Coherence and Terracotta do it. Coherence, with which I'm far more familiar, has mechanisms to listen to cache events either in general or for specific nodes. That's probably what you should emulate You also might want to look at the documentation for either of those even if its just as a guide or source of ideas You don't say what platform you're running in but perhaps we can suggest some alternatives to rolling your own, which is always going to be fraught with problems, particularly with something as complicated as a cache (make no mistake: caches are complicated).
Namely, B should listen to events that affect it's liveness, in this case the state of A. A Map is a pretty natural abstraction for a cache and this is how Oracle Coherence and Terracotta do it. Coherence, with which I'm far more familiar, has mechanisms to listen to cache events either in general or for specific nodes.
That's probably what you should emulate. You also might want to look at the documentation for either of those even if its just as a guide or source of ideas. You don't say what platform you're running in but perhaps we can suggest some alternatives to rolling your own, which is always going to be fraught with problems, particularly with something as complicated as a cache (make no mistake: caches are complicated).
I use the observer pattern to cache clear in other places. This dosn't quite solve my problem but the last paragraph deserves to be pomoted so I am marking it as right. – Jeremy French Jan 29 '09 at 10:14.
As part of a system I am working on we have put a layer of caching in a proxy which calls another system. The key to this cache is built up of the key value pairs which are used in the proxy call. So if the proxy is called with the same values the item will be retrieved from the cache rather than from the other service.
This works and is fairly simple. It gets more complicated when it comes to clearing the cache as it is not obvious which items to clear when an item is changed. If object A is contained in nodeset B and object A is changed, how do we know that nodeset B is stale.
We have got round the problem by having the service that we call return the nodesets to clear when objects are changed. However this breaks encapsulation and adds a layer of complexity in that we have to look in the responses to see what needs clearing. Is there a better/standard way to deal with such situations.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.