Constructs a PersistentHandleCache object
PersistentHandleCache<T>( CHandleFormatter<T>* formatter = 0, const TCHAR* pszDataFile, long lMaxSavedItemCount, long lMaxSavedItemAge, bool bAutoSave = true, long lVersion = 1 ); |
A pointer to an object derived from CHandleFormatter<T>. If set to 0, then a default formatter will be created.
Once the object has been passed to the constructor, the object
is owned by the HandleCache, and will be deleted by it
at the appropriate time.
The developer should not delete instances of formatters
that have been passed to the constructor.
The developer should not create instances of formatters
on the stack; they must be created on the heap,
using new
.
The full path to the file to be used for persistent storage.
The path may include environmment variables such as %TMP%
,
which will be expanded when the file is opened.
The maximum number of objects that will ever be saved to the persistent storage. If the value is 0 or negative, then the file will be of unlimited size.
The maximum age of an object in seconds. Any objects which have been unused for this time or longer will be purged from the cache when it is saved. If the value is 0 or negative, then objects will not be limited with regard to age.
If true, then the cache will automatically be restored when the XLL is opened, and saved when the XLL is closed. if false, then the developer is responsible for restoring and saving the cache, by calling the Save and Restore methods.
If a cache file exists, and the saved version number does not match the value provided, then the cache file will be ignored, and will not be restored. When the cache is next saved, the contents of the existing file will be discarded.
You should increment this number whenever you change the serialization code for stored objects. This will safely invalidate existing caches in the old format, removing the need to individually delete them.
Header: rtdhandles.h
PersistentHandleCache<T> Class | PersistentHandleCache<T> Methods