Skip to content

remix/assets · Interface

View Source

FileCache

Summary

A cache of files addressed by opaque string keys. Implementations own admission, eviction, and persistence, and may discard entries at any time.

Signature

interface FileCache {
  get(key: string): File | Promise<File | null> | null
  put(key: string, file: File): void | File | Promise<void | File>
}

Methods

get(key: string): File | Promise<File | null> | null

Returns a cached file, preserving its bytes, name, type, and lastModified value.

Parameters

key

The cache key.

put(key: string, file: File): void | File | Promise<void | File>

Stores or replaces a file. The cache may decline to store it according to its policy.

Parameters

key

The cache key.

file

The file to cache.