libosmscout  0.1
osmscout::DataTileCache Class Reference

#include <DataTileCache.h>

Public Member Functions

void CleanupCache ()
 Cleanup the cache. More...
 
 DataTileCache (size_t cacheSize)
 Create a new tile cache with the given cache size. More...
 
TileRef GetCachedTile (const TileKey &id) const
 Return the cache tiles with the given id. More...
 
size_t GetCurrentSize () const
 
size_t GetSize () const
 
TileRef GetTile (const TileKey &id) const
 Return the tile with the given id. More...
 
void GetTilesForBoundingBox (const Magnification &magnification, const GeoBox &boundingBox, std::list< TileRef > &tiles) const
 Return all tile necessary for covering the given boundingbox using the given magnification. More...
 
void InvalidateCache ()
 Mark all tiles as in cache as "incomplete". More...
 
void PrefillDataFromCache (Tile &tile, const TypeInfoSet &nodeTypes, const TypeInfoSet &wayTypes, const TypeInfoSet &areaTypes, const TypeInfoSet &routeTypes, const TypeInfoSet &optimizedWayTypes, const TypeInfoSet &optimizedAreaTypes)
 (Partially) prefill the given tiles with data already cached with data of the given types. More...
 
void SetSize (size_t cacheSize)
 Change the size of the cache. More...
 

Detailed Description

Data cache using tile based cache pages. The cache holds a number of of tiles. The maximum number of tiles hold can be configured. Tiles however will only be freed if a cleanup is explicitely triggered. So temporary overbooking can happen. This should assure that prefilling of tiles is possible even with a very low limit.

The cache will free least recently used tiles first,

Constructor & Destructor Documentation

◆ DataTileCache()

osmscout::DataTileCache::DataTileCache ( size_t  cacheSize)
explicit

Create a new tile cache with the given cache size.

Member Function Documentation

◆ CleanupCache()

void osmscout::DataTileCache::CleanupCache ( )

Cleanup the cache.

Free least recently used tiles until the given maximum cache size is reached again.

Referenced by osmscout::MapService::CleanupTileCache(), and SetSize().

◆ GetCachedTile()

TileRef osmscout::DataTileCache::GetCachedTile ( const TileKey key) const

Return the cache tiles with the given id.

If the tiles is not cache, an empty reference will be returned.

◆ GetCurrentSize()

size_t osmscout::DataTileCache::GetCurrentSize ( ) const
inline

◆ GetSize()

size_t osmscout::DataTileCache::GetSize ( ) const
inline

◆ GetTile()

TileRef osmscout::DataTileCache::GetTile ( const TileKey key) const

Return the tile with the given id.

If the tile is not currently cached return an empty and unassigned tile and move it to the front of the cache.

Referenced by GetTilesForBoundingBox(), and osmscout::MapService::LookupTile().

◆ GetTilesForBoundingBox()

void osmscout::DataTileCache::GetTilesForBoundingBox ( const Magnification magnification,
const GeoBox boundingBox,
std::list< TileRef > &  tiles 
) const

Return all tile necessary for covering the given boundingbox using the given magnification.

References osmscout::GeoBox::GetMaxCoord(), osmscout::GeoBox::GetMinCoord(), osmscout::TileId::GetTile(), and GetTile().

Referenced by osmscout::MapService::LookupTiles().

◆ InvalidateCache()

void osmscout::DataTileCache::InvalidateCache ( )

Mark all tiles as in cache as "incomplete".

Referenced by osmscout::MapService::InvalidateTileCache().

◆ PrefillDataFromCache()

void osmscout::DataTileCache::PrefillDataFromCache ( Tile tile,
const TypeInfoSet nodeTypes,
const TypeInfoSet wayTypes,
const TypeInfoSet areaTypes,
const TypeInfoSet routeTypes,
const TypeInfoSet optimizedWayTypes,
const TypeInfoSet optimizedAreaTypes 
)

(Partially) prefill the given tiles with data already cached with data of the given types.

Currently prefill is done by looking for the parent tile in the cache and copying data that intersects the bounding box of the given tile.

References osmscout::Tile::GetBoundingBox(), osmscout::Tile::GetKey(), osmscout::Tile::GetLevel(), and osmscout::TileKey::GetParent().

◆ SetSize()

void osmscout::DataTileCache::SetSize ( size_t  cacheSize)

Change the size of the cache.

Cache will be cleaned immediately.

References CleanupCache().

Referenced by osmscout::MapService::FlushTileCache(), and osmscout::MapService::SetCacheSize().


The documentation for this class was generated from the following files: