DataCache





 

Attributes Summary

lifetimeInCache The lifetime, in seconds, of cached data for an instance of this bean type.
lifetimeInCacheUsage How the lifetimeInCache value will be used by the caching mechanism.

 

Attribute Details


lifetimeInCache

The lifetime, in seconds, of cached data for an instance of this bean type. The miminum value, 0, (the default) means cached data for a bean instance will not live beyond the end of the transaction in which it was retrieved (typically via a finder method). Any non-zero value means the cached data will live beyond end of transaction; this may avoid a trip to the backend datastore if this same bean instance is used in later transactions. The maximum value is (2**61) -1 seconds (which is (2**64)-1 milliseconds). A non-zero value is typically used for beans which can be seen as read-only. Such beans usually are updated only a regular, predictable intevals such as every hour or at 3am nightly.

Data type:   Long
Default value:   0



lifetimeInCacheUsage

How the lifetimeInCache value will be used by the caching mechanism. It can be one of the following values:Off - the lifetimeInCache value is ignored. Beans of this type are only cached in a TransactionScopedCache The cached data for this instance is invalid when the transaction it was fetched in is completed.ElapsedTime - lifetimeInCache is added to the current time when the transaction (in which the bean instance was retrieved) is completed. The cached data for this instance is invalid after this time. The value of lifetimeInCache may add up to minutes, hours, days, etc.ClockTime - the value of "lifetimeInCache" represents a particular time of day. The value is added to the immediately preceeding or following midnight to calculate a future time value, which is then treated as for ElapsedTime. Using "ClockTime" allows you to specify that all instances of this bean type should have their cached data invalidated at, say, 3am - no matter when they were retrieved. This is important if, for example, the data underlying this bean type is batch-updated at 3am every night. The use of "preceeding" vs "following" midnight depends on the value of lifetimeInCache; if lifetimeInCache plus preceeding midnight is earlier then the current time then the following midnight is used. When usage is ClockTime, the value of "lifetimeInCache" should not represent more than 24 hours. If it does, CacheManager will subtract 24-hour increments from it until a value less than or equal to 24 hours is achieved. To invalidate data at 12 midnight, lifetimeInCache should be set to 0.WeekTime - this is the same as ClockTime except the value of lifetimeInCache is added to the preceeding or following Sunday midnight (11:59pm Saturday plus 1 minute). Here, the value of lifetimeInCache may represent more than 24 hours but not more than 7 days.

Data type:  LifetimeInCacheUsageKind
Default value:   unspecified
Allowed Values:  OFF   ELAPSED_TIME   CLOCK_TIME   WEEK_TIME