Skip to content

remix/assets · Function

View Source

createFsFileCache

Summary

Creates a persistent filesystem cache that evicts least recently used entries. Reads and writes refresh an in-memory index. On first use, the index is rebuilt from stored write timestamps; read recency is not preserved across restarts. Use one cache instance per directory. For shared multi-process caching, provide a custom FileCache. Files exceeding either byte limit are not cached. All limits must be positive safe integers. Storage metadata and filesystem overhead are additional to the byte budgets.

Signature

function createFsFileCache(options: FsFileCacheOptions): FileCache

Parameters

options

Cache directory, entry count, and byte limits.

Returns

A file cache suitable for files.cache in createAssetServer().