-
Notifications
You must be signed in to change notification settings - Fork 4
caching
There are 3 tings, that will be cached.
- Mapnik Style XML for each date
- tile cache location
- tile
The cache will be filled on each HTTP
request, where there is no cached file
or when using the prerendering command.
$ docker-compose -f local.yml run --rm django python manage.py prerender [ZOOM_LEVEL]
Below is a diagram, how the cache is used in a view.
Cache will be created, when a tile process is running. For each date, the system need a different mapnik style XML.
Cache location of a tile. To save space on the cache server, every tile will
be hashed with MD5
and saved under the MD5
value. When multiple tiles have
the same MD5
hash, then only one tile will be saved. The cache location key
is year-month-day-zoom-X-Y
.
Finally, the tile PNG. The cache key is the hash value of the tile.
In the config file, you can set, how low the cache should be saved.
# caching
# ------------------------------------------------------------------------------
# to which zoom level tiles should cached
ZOOM_LEVEL=13
# 2592000 == 1 month
TILE_CACHE_TIME=2592000
ZOOM_LEVEL to which zoom level the cache should be stored.
TILE_CACHE_TIME how long a tile should be cached in seconds.
To clear up all cached files use
$ docker-compose -f local.yml run --rm django python manage.py clear_cache
But be careful, this command can't be undone!
To save space on the cache system, any cache object will be compressed with lzma
.
To change the compression mode, modify config/settings/production.py
under
CACHES
. All available compression modes are listed here: https://docs.python.org/3/library/lzma.html#module-lzma