ExPmtiles.Cache.FileHandler (ExPmtiles v0.3.4)

View Source

Pure functions for file-based cache operations.

This module handles all file system operations for the cache, including reading, writing, and clearing cache files.

Summary

Functions

Clears all cache files (both tiles and directories) for a given cache path.

Clears the directory cache directory.

Clears the tile cache directory.

Initializes cache directories for a given cache path.

Reads a tile from the cache file. Returns {:ok, tile_data} on success, :error on failure.

Generates the file path for a cached tile.

Writes tile data to a cache file. Returns :ok on success, :error on failure.

Functions

clear_cache_files(cache_path)

Clears all cache files (both tiles and directories) for a given cache path.

clear_directory_cache(cache_path)

Clears the directory cache directory.

clear_tile_cache(cache_path)

Clears the tile cache directory.

init_cache_directories(cache_path, enable_tile_cache, enable_dir_cache)

Initializes cache directories for a given cache path.

read_tile_from_cache(cache_file_path)

Reads a tile from the cache file. Returns {:ok, tile_data} on success, :error on failure.

tile_cache_file_path(cache_dir, tile_id)

Generates the file path for a cached tile.

write_tile_to_cache(cache_file_path, tile_data)

Writes tile data to a cache file. Returns :ok on success, :error on failure.