MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLPersistentCacheData Class Reference

Detailed Description

Persistent cache class.

Holds settings used to initialise the persistent cache of a TSLMapDataLayer.

Use the 'loadFromIniFile' method to load settings from an existing persistent cache ini file.

Public Member Functions

 TSLPersistentCacheData ()
 
bool checkValidityDuringIdle () const
 
void checkValidityDuringIdle (bool newVal)
 
void destroy ()
 
const char * directory () const
 
void directory (const char *newVal)
 
bool flushDuringIdle () const
 
void flushDuringIdle (bool newVal)
 
int garbagePercentage () const
 
void garbagePercentage (int newVal)
 
bool indexEveryUpdate () const
 
void indexEveryUpdate (bool newVal)
 
bool loadFromIniFile (const char *fileName, const char *section)
 
bool maxCompression () const
 
void maxCompression (bool newVal)
 
int maxSizeMB () const
 
void maxSizeMB (int newVal)
 
const char * sortOrder () const
 
void sortOrder (const char *newVal)
 
TSLTMC tmcUnit () const
 
void tmcUnit (TSLTMC newVal)
 
void * operator new (size_t size) TSL_NO_THROW
 
void * operator new (size_t size, char *filename, int line)
 

Constructor & Destructor Documentation

◆ TSLPersistentCacheData()

TSLPersistentCacheData::TSLPersistentCacheData ( )

Member Function Documentation

◆ checkValidityDuringIdle() [1/2]

bool TSLPersistentCacheData::checkValidityDuringIdle ( ) const

Returns the checkValidityDuringIdle flag.

If this flag is true, then during idle processing, tiles that are in the cache but have not been used this session are checked for validity in case they are needed.

◆ checkValidityDuringIdle() [2/2]

void TSLPersistentCacheData::checkValidityDuringIdle ( bool newVal)

Sets the checkValidityDuringIdle flag.

If this flag is true, then during idle processing, tiles that are in the cache but have not been used this session are checked for validity in case they are needed.

Parameters
newValvalue required for the checkValidityDuringIdle flag

◆ destroy()

void TSLPersistentCacheData::destroy ( )

Destroy method. This should be called rather than deleting the persistent cache object, since the calls are redirected internally to MapLink.

◆ directory() [1/2]

const char * TSLPersistentCacheData::directory ( ) const

Returns the directory where the persistent tiles should be stored. Any environment variables specified in this path are expanded.

◆ directory() [2/2]

void TSLPersistentCacheData::directory ( const char * newVal)

Sets the directory where the persistent tiles should be stored. Any environment variables specified in this path are expanded.

Parameters
newValvalue for the directory

◆ flushDuringIdle() [1/2]

bool TSLPersistentCacheData::flushDuringIdle ( ) const

Returns the flush during idle flag.

If this flag is true, then the persistent cache is flushed during idle processing.

◆ flushDuringIdle() [2/2]

void TSLPersistentCacheData::flushDuringIdle ( bool newVal)

Sets the flush during idle flag.

If this flag is true, then the persistent cache is flushed during idle processing.

Parameters
newValvalue required for the flushDuringIdle flag.

◆ garbagePercentage() [1/2]

int TSLPersistentCacheData::garbagePercentage ( ) const

Returns the percentage of the cache that is freed during a flush.

For example, if this value was 10, then the cache would be reduced to 90% of its maximum size when flushed. The tiles would be deleted based upon the priority sort order.

◆ garbagePercentage() [2/2]

void TSLPersistentCacheData::garbagePercentage ( int newVal)

Sets the percentage of the cache that is freed during a flush.

For example, if this value was 10, then the cache would be reduced to 90% of its maximum size when flushed. The tiles would be deleted based upon the priority sortOrder specified above.

Parameters
newValthe value required

◆ indexEveryUpdate() [1/2]

bool TSLPersistentCacheData::indexEveryUpdate ( ) const

Returns the indexEveryUpdate flag.

This flag indicates whether the cache index should be written whenever it needs updating. This will affect performance when the cache is large, or the file system slow, but may be necessary if the system cannot be closed cleanly. The index is usually written when the TSLMapDataLayer is deleted.

◆ indexEveryUpdate() [2/2]

void TSLPersistentCacheData::indexEveryUpdate ( bool newVal)

Sets the indexEveryUpdate flag.

This flag indicates whether the cache index should be written whenever it needs updating. This will affect performance when the cache is large, or the file system slow, but may be necessary if the system cannot be closed cleanly. The index is usually written when the TSLMapDataLayer is deleted.

Parameters
newValrequired value for the indexEveryUpdate flag

◆ loadFromIniFile()

bool TSLPersistentCacheData::loadFromIniFile ( const char * fileName,
const char * section )

Loads the persistent cache settings from an existing persistent cache ini file.

The configuration file should be of the form:

[persistent cache]
directory=%DASCACHEPATH%/pcache
maxSizeMb=20
bool maxCompression() const
const char * sortOrder() const
int garbagePercentage() const
bool checkValidityDuringIdle() const
TSLTMC tmcUnit() const
bool indexEveryUpdate() const
const char * directory() const
bool flushDuringIdle() const

The entries in the configuration file are:

  • directory: This is the directory where the persistent tiles should be stored. Any environment variables specified in this path are expanded.
  • maxSizeMb: This is the maximum size of the persistent cache, in Mb.
  • sortOrder: This string defines the priority order for sort tiles. When flushing the cache, tiles of a lower priority will be flushed first. Each letter in the string represents a boolean condition used when sorting. 'V' is whether the tile has been validated or not. 'A' is the last access time - more recent is a higher priority. 'C' is the number of times the tile has been accessed whilst in the cache. 'S' is the size of the tile - larger is considered more important to cache. The order of these letters in the string indicates the relative priority of these conditions. The example 'VACS' sorts first by tile validity, then by last access time, then by access count and finally by tile size.
  • maxCompression: If this flag is 1, then the tiles are stored in the cache as if the 'optimise for size' flag was set in the processing tool. Note that this only has an effect if the tile was optimised when created, although this can be applied if optimised for speed.
  • tmcUnit: This value is used when the maxCompression flag is 1. It represents the 'Optimisation scale factor' which would be entered in the MapLink Processing tool.
  • flushDuringIdle: If this flag is 1, then the persistent cache is flushed during idle processing.
  • checkValidityDuringIdle: If this flag is 1, then during idle processing, tiles that are in the cache but have not been used this session are checked for validity in case they are needed.
  • garbagePercentage: This is the percentage of the cache that is freed during a flush. For example, if this value was 10, then the cache would be reduced to 90% of its maximum size when flushed. The tiles would be deleted based upon the priority sortOrder specified above.
  • indexEveryUpdate: This flag indicates whether the cache index should be written whenever it needs updating. This will affect performance when the cache is large, or the file system slow, but may be necessary if the system cannot be closed cleanly. The index is usually written when the TSLMapDataLayer is deleted.
Parameters
fileNameThis is the name of configuration file. The file must be local, not remote. The filename may be absolute, or the file may be found in the system path or maplink path search directories.
sectionThis is the section within the configuration file. In the example above, this is "persistent cache".

◆ maxCompression() [1/2]

bool TSLPersistentCacheData::maxCompression ( ) const

Returns the maxCompression flag.

If this flag is true, then the tiles are stored in the cache as if the 'optimise for size' flag was set in the processing tool. Note that this only has an effect if the tile was optimised when created, although this can be applied if optimised for speed.

◆ maxCompression() [2/2]

void TSLPersistentCacheData::maxCompression ( bool newVal)

Sets the maxCompression flag.

If this flag is true, then the tiles are stored in the cache as if the 'optimise for size' flag was set in the processing tool. Note that this only has an effect if the tile was optimised when created, although this can be applied if optimised for speed.

Parameters
newValvalue required for the maxCompression flag

◆ maxSizeMB() [1/2]

int TSLPersistentCacheData::maxSizeMB ( ) const

Returns the maximum size of the persistent cache, in MB.

◆ maxSizeMB() [2/2]

void TSLPersistentCacheData::maxSizeMB ( int newVal)

Sets the maximum size of the persistent cache, in MB.

Parameters
newValrequired size in MB.

◆ operator new() [1/2]

void * TSLPersistentCacheData::operator new ( size_t size)

Allocation override for API redirection

◆ operator new() [2/2]

void * TSLPersistentCacheData::operator new ( size_t size,
char * filename,
int line )

When included in an MFC application in debug mode, the debug new expects this to be here. Override it and return the same as the normal one. The library must include it when compiled in release mode, since the user's application may be in debug mode.

◆ sortOrder() [1/2]

const char * TSLPersistentCacheData::sortOrder ( ) const

Returns the string defining the priority order for sorting tiles.

When flushing the cache, tiles of a lower priority will be flushed first. Each letter in the string represents a boolean condition used when sorting. 'V' is whether the tile has been validated or not. 'A' is the last access time - more recent is a higher priority. 'C' is the number of times the tile has been accessed whilst in the cache. 'S' is the size of the tile - larger is considered more important to cache. The order of these letters in the string indicates the relative priority of these conditions. The example 'VACS' sorts first by tile validity, then by last access time, then by access count and finally by tile size.

◆ sortOrder() [2/2]

void TSLPersistentCacheData::sortOrder ( const char * newVal)

Sets the string defining the priority order for sort tiles.

When flushing the cache, tiles of a lower priority will be flushed first. Each letter in the string represents a boolean condition used when sorting. 'V' is whether the tile has been validated or not. 'A' is the last access time - more recent is a higher priority. 'C' is the number of times the tile has been accessed whilst in the cache. 'S' is the size of the tile - larger is considered more important to cache. The order of these letters in the string indicates the relative priority of these conditions. The example 'VACS' sorts first by tile validity, then by last access time, then by access count and finally by tile size.

Parameters
newValthe required priority order.

◆ tmcUnit() [1/2]

TSLTMC TSLPersistentCacheData::tmcUnit ( ) const

Returns the optimisation scale factor.

This value is used when the maxCompression flag is true. It represents the 'Optimisation scale factor' which would be entered in the MapLink Processing tool.

◆ tmcUnit() [2/2]

void TSLPersistentCacheData::tmcUnit ( TSLTMC newVal)

Sets the optimisation scale factor.

Parameters
newValnew scale factor.

This value is used when the maxCompression flag is true. It represents the 'Optimisation scale factor' which would be entered in the MapLink Processing tool.