com.waveset.object
Interface CacheConsistencyNumberLoader

All Known Subinterfaces:
ObjectLoader, Session
All Known Implementing Classes:
AbstractLighthouseContext, AbstractSession, ChangeWatcher, LocalSession, ObjectLoaderBase

public interface CacheConsistencyNumberLoader

Originally part of ObjectLoader. Factored out such that it only contains the single method getCacheConsistencyNumber. Used by ChangeWatcher for caching the cache consistency number.


Method Summary
 long getCacheConsistencyNumber(Type type)
          Return a Cache Consistency Number.
 

Method Detail

getCacheConsistencyNumber

public long getCacheConsistencyNumber(Type type)
                               throws WavesetException
Return a Cache Consistency Number. This will be called by the ObjectCache prior to any operation that wants to keep the cache up to date. The number returned will be stored in the cache, when it changes, the cache will be flushed.

The loader typically runs a database query after some number of calls to this method, and returns the current CCN. The loader typically does NOT query the database on every call to this method. While that would ensure that the cache is always up to date, it would slow things down, defeating some of the purpose of the cache. The loader should maintain a timestamp of the last database query, and reissue the query after a configurable number of seconds has passed. This behavior is put into the loader rather than the cache so we have fewer objects to update in case the CCN "polling interval" changes.

Throws:
WavesetException