ChamplainFileCache

## ChamplainFileCache ChamplainFileCache — Stores and loads cached tiles from the file system |

## Synopsis

    struct              ChamplainFileCache;
    ChamplainFileCache * champlain_file_cache_new_full      (guint size_limit,
                                                             const gchar *cache_dir,
                                                             ChamplainRenderer *renderer);
    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 cache that stores and retrieves tiles from the file system. Tiles most frequently loaded gain in "popularity". This popularity is taken into account when purging the cache.

## Details

### struct ChamplainFileCache

    struct ChamplainFileCache;

The ChamplainFileCache structure contains only private data and should be accessed using the provided API

Since 0.6

### champlain_file_cache_new_full ()

    ChamplainFileCache * champlain_file_cache_new_full      (guint size_limit,
                                                             const gchar *cache_dir,
                                                             ChamplainRenderer *renderer);

Constructor of ChamplainFileCache.

`size_limit` : | maximum size of the cache in bytes
`cache_dir` : | the directory where the cache is created. When cache_dir == NULL, a cache in ~/.cache/champlain is used. [allow-none]
`renderer` : | the ChamplainRenderer used for tiles rendering
Returns : | a constructed ChamplainFileCache

Since 0.8

### 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