![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]()
|
CachingReference: News Introduction Configuration CacheFactory implementation Cache implementation CacheManager - monitoring and clearing caches NewsRelease 0.9.6: IntroductionAs explained in The main component of this package is the interface Cache, which declares the external functionality of a performance cache. Existing (and future) cache implementations have to implement this interface, which is closely modelled after java.util.Map. ConfigurationCastor (as of release 0.9.6) allows for addition of user-defined cache implementations. By default, the file castor.properties includes a section as follows:
To add your own performance cache implementation, please append the fully-qualified class name to this list as shown here:
In addition, you will have to provide the implementations of Cache and CacheFactory for your new cache instance. CacheFactory implementationFor this, please add an implementation of CacheFactory and make sure that you provide valid values for the two properties name and className. To assist users in this task, a AbstractCacheFactory class has been supplied, which users should derive their custom CacheFactory instances from, if they wish so. Please consult existing CacheFactory implementations such as TimeLimitedFactory} or CountLimitedFactory for code samples.
Cache implementationFor this, please create an implementation of Cache. To assist users in this task, a AbstractBaseCache class has been supplied, which users should derive their custom Cache instances from, if they wish so. Please consult existing Cache implementations such as TimeLimited} or CountLimited for code samples.
CacheManager - monitoring and clearing cachesSometimes it is necessary to interact with Castor's performance caches to e.g. (selectively) clear a Castor performance cache of its content, or inquire about whether a particular object instance (as identified by its identity) is cached already. For this purpose a CacheManager can be obtained from a Database instance by issuing the following code:
This instance can subsequently be used to selectively clear the Castor performance cache using one of the following methods:
To inquire whether an object has already been cached, please use the following method: Please note that once you have closed the Database instance from which you have obtained the CacheManager, the CacheManager cannot be used anymore and will throw a PersistenceException. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() ![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |