ChamplainFileCache

ChamplainFileCache — Stores and loads cached tiles from the file system

Synopsis

                    ChamplainFileCache;
ChamplainFileCache* champlain_file_cache_new            (void);
ChamplainFileCache* champlain_file_cache_new_full       (guint size_limit,
                                                         const gchar *cache_dir,
                                                         gboolean persistent);
void                champlain_file_cache_set_size_limit (ChamplainFileCache *file_cache,
                                                         guint size_limit);
guint               champlain_file_cache_get_size_limit (ChamplainFileCache *file_cache);
const gchar *       champlain_file_cache_get_cache_dir  (ChamplainFileCache *file_cache);
void                champlain_file_cache_purge          (ChamplainFileCache *file_cache);
void                champlain_file_cache_purge_on_idle  (ChamplainFileCache *file_cache);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----ChamplainMapSource
               +----ChamplainTileCache
                     +----ChamplainFileCache

Properties

  "cache-dir"                gchar*                : Read / Write / Construct Only
  "size-limit"               guint                 : Read / Write / Construct

Description

ChamplainFileCache is a map source that stores and retrieves tiles from the file system. It can be temporary (deleted when the object is destroyed) or permanent. Tiles most frequently loaded gain in "popularity". This popularity is taken into account when purging the cache.

Details

ChamplainFileCache

typedef struct _ChamplainFileCache ChamplainFileCache;


champlain_file_cache_new ()

ChamplainFileCache* champlain_file_cache_new            (void);

Default constructor of ChamplainFileCache.

Returns :

a constructed permanent cache of maximal size 100000000 B inside ~/.cache/champlain.

Since 0.6


champlain_file_cache_new_full ()

ChamplainFileCache* champlain_file_cache_new_full       (guint size_limit,
                                                         const gchar *cache_dir,
                                                         gboolean persistent);

Constructor of ChamplainFileCache.

size_limit :

maximal size of the cache in bytes

cache_dir :

the directory where the cache is created. For temporary caches one more directory with random name is created inside this directory. When cache_dir == NULL, a cache in ~/.cache/champlain is used for permanent caches and /tmp for temporary caches.

persistent :

if TRUE, the cache is persistent; otherwise the cache is temporary and will be deleted when the cache object is destructed.

Returns :

a constructed ChamplainFileCache

Since 0.6


champlain_file_cache_set_size_limit ()

void                champlain_file_cache_set_size_limit (ChamplainFileCache *file_cache,
                                                         guint size_limit);

Sets the cache size limit in bytes.

file_cache :

a ChamplainFileCache

size_limit :

the cache limit in bytes

Since 0.4


champlain_file_cache_get_size_limit ()

guint               champlain_file_cache_get_size_limit (ChamplainFileCache *file_cache);

Gets the cache size limit in bytes.

file_cache :

a ChamplainFileCache

Returns :

size limit

Since 0.4


champlain_file_cache_get_cache_dir ()

const gchar *       champlain_file_cache_get_cache_dir  (ChamplainFileCache *file_cache);

Gets the directory where the cache database is stored.

file_cache :

a ChamplainFileCache

Returns :

the directory

Since 0.6


champlain_file_cache_purge ()

void                champlain_file_cache_purge          (ChamplainFileCache *file_cache);

Purge the cache from the less popular tiles until cache's size limit is reached.

file_cache :

a ChamplainFileCache

Since 0.4


champlain_file_cache_purge_on_idle ()

void                champlain_file_cache_purge_on_idle  (ChamplainFileCache *file_cache);

Purge the cache from the less popular tiles until cache's size limit is reached. This is a non blocking call as the purge will happen when the application is idle

file_cache :

a ChamplainFileCache

Since 0.4

Property Details

The "cache-dir" property

  "cache-dir"                gchar*                : Read / Write / Construct Only

The directory where the tile database is stored.

Default value: NULL

Since 0.6


The "size-limit" property

  "size-limit"               guint                 : Read / Write / Construct

The cache size limit in bytes.

Note: this new value will not be applied until you call champlain_cache_purge

Allowed values: [1,G_MAXINT]

Default value: 100000000

Since 0.4