class diagram:
Applications use the ObjectCacheFactory to create new ObjectCaches. These caches supply methods for storing and retrieving objects. Objects can be looked up by their identity which is represented by the class Identiy. Each implementation of ObjectCache represents a different caching strategy. Currently the following caching strategies are supported:
PersistenceBroker
instance. The cache will be cleared on every PersistenceBroker#close()
method call (means when the broker instance was returned to pool).
Patterns applied: Configurable Factory: ObjectCacheFactory is a factory for objects implementing the ObjectCache interface. Proxy, Composite: MetaObjectCacheImpl is a kind of proxy for the real object caches. (Although it is not a proxy for a single object but for all caches.)
Todo: 1. Is it possible to remove the dependency of this package on ojb.broker and ojb.broker.metadata? A cache might me useful outside of OJB. The dependency comes from using Identy and PersistenceBrokerFactory. Is Identy really necessary? We might place the burden of creating a Identy on the class which wants to cache objects (simply by removing the method cache(Object)). Removing the dependency on Identy removes the dependency on ClassNotPersistenceCapableException as well since this exception is thrown in the constructor of Identy.