ExPmtiles.Cache.Operations (ExPmtiles v0.3.4)

View Source

Pure business logic for PMTiles cache operations.

This module contains all the tile fetching and caching logic without any GenServer-specific code. All functions are pure and easily testable.

The architecture is simplified: each request process does its own work, checking file-based caches and fetching from storage as needed. No inter-process coordination is needed because the filesystem handles concurrent access naturally.

Summary

Functions

Fetches a tile from the PMTiles file and optionally caches it.

Handles a tile request when tile caching is enabled.

Handles a tile request, checking cache and fetching if needed.

Handles a tile request when tile caching is disabled.

Functions

fetch_tile(pmtiles, tile_id, z, x, y, config, enable_tile_cache, enable_dir_cache)

Fetches a tile from the PMTiles file and optionally caches it.

This does all the work synchronously in the calling process.

handle_cached_tile_request(pmtiles, tile_id, z, x, y, config, enable_dir_cache)

Handles a tile request when tile caching is enabled.

handle_tile_request(pmtiles, tile_id, z, x, y, config, bool, enable_dir_cache)

Handles a tile request, checking cache and fetching if needed.

This function is called in the context of the requesting process (e.g., Phoenix request). It does all the work synchronously in the caller's process.

handle_uncached_tile_request(pmtiles, tile_id, z, x, y, config, enable_dir_cache)

Handles a tile request when tile caching is disabled.