gws.gis.cache.core
¶
Cache management.
Source code: gws.gis.cache.core
Module Contents¶
- gws.gis.cache.core.cleanup(root: gws.Root)¶
Remove stale cache directories.
- Parameters:
root – Application root object.
- Returns:
None. Stale directories are removed from the filesystem.
- class gws.gis.cache.core.Config(*args, **kwargs)¶
Bases:
gws.Config
Global cache options
- seedingConcurrency: int = 1¶
Number of concurrent seeding jobs.
- seedingMaxTime: gws.Duration = '600'¶
Max. time for a seeding job.
- gws.gis.cache.core.DEFAULT_CONCURRENCY = 1¶
- gws.gis.cache.core.DEFAULT_MAX_AGE = 604800¶
- gws.gis.cache.core.DEFAULT_MAX_LEVEL = 3¶
- gws.gis.cache.core.DEFAULT_MAX_TIME = 600¶
- gws.gis.cache.core.drop(root: gws.Root, layer_uids=None)¶
Remove active cache directories.
- Parameters:
root – Application root object.
layer_uids – Optional list of layer UIDs to filter by.
- Returns:
None. Cache directories are removed from the filesystem.
- class gws.gis.cache.core.Entry(*args, **kwargs)¶
Bases:
gws.Data
Basic data object.
This object can be instantiated by passing one or or
dict
arguments and/or keyword args. All dicts keys and keywords become attributes of the object.Accessing an undefined attribute returns
None
and no error is raised, unless the attribute name starts with an underscore.- config: dict¶
- counts: dict¶
- dirname: str¶
- mpxCache: dict¶
- uid: str¶
- class gws.gis.cache.core.Grid(*args, **kwargs)¶
Bases:
gws.Data
Basic data object.
This object can be instantiated by passing one or or
dict
arguments and/or keyword args. All dicts keys and keywords become attributes of the object.Accessing an undefined attribute returns
None
and no error is raised, unless the attribute name starts with an underscore.- cachedTiles: int¶
- maxX: int¶
- maxY: int¶
- res: float¶
- totalTiles: int¶
- uid: str¶
- z: int¶
- gws.gis.cache.core.PIXEL_PNG8 = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x03\x00\x00\x00(\xcb4\x...¶
- gws.gis.cache.core.seed(root: gws.Root, entries: list[Entry], levels: list[int])¶
Generate and populate the cache for specified layers and zoom levels.
- Parameters:
root – Application root object.
entries – List of cache entries to seed.
levels – List of zoom levels to generate cache for.
- Returns:
None. Cache is populated with generated tiles.
- class gws.gis.cache.core.Status(*args, **kwargs)¶
Bases:
gws.Data
Basic data object.
This object can be instantiated by passing one or or
dict
arguments and/or keyword args. All dicts keys and keywords become attributes of the object.Accessing an undefined attribute returns
None
and no error is raised, unless the attribute name starts with an underscore.- staleDirs: list[str]¶
- gws.gis.cache.core.status(root: gws.Root, layer_uids=None, with_counts=True) Status ¶
Retrieve cache status information.
- Parameters:
root – Application root object.
layer_uids – Optional list of layer UIDs to filter by.
with_counts – Whether to include tile counts in the status.
- Returns:
Status object containing cache entries and stale directories.
- gws.gis.cache.core.store_in_web_cache(url: str, img: bytes)¶
Store an image in the web cache.
- Parameters:
url – URL path to use as the cache key.
img – Binary image data to store.
- Returns:
None. Image is stored in the cache.