What is the best strategy to refactor a Singleton object to a cluster environment?
We use Singleton to cache some custom information from Database. Its mostly read-only but gets refreshed when some particular event occurs.
Now our application needs to be deployed in a Clustered environment. By definition, each JVM will have its own Singleton instance. So the cache may be out-of-sync between the JVM's when a refresh event occurs on a single node and its cache is refreshed.
What is the best way to keep the cache's in sync?
Thanks.
Edit: The cache is mainly used to provide an autocomplete list (performance reasons) to UI and we use Websphere. So any Websphere related tips welcome.