📄 threejs/Core/Loaders/Cache

File: Cache.md | Updated: 11/15/2025


title: Cache category: Core layout: docs

Cache

A simple caching system, used internally by FileLoader. To enable caching across all loaders that use FileLoader, add THREE.Cache.enabled = true. once in your app.

Properties

.enabled : boolean

Whether caching is enabled or not.

Default is false.

.files : Object.<string, Object>

A dictionary that holds cached files.

Static Methods

.add( key : string, file : Object )

Adds a cache entry with a key to reference the file. If this key already holds a file, it is overwritten.

key | The key to reference the cached file.
---|---
file | The file to be cached.

.clear()

Remove all values from the cache.

.get( key : string ) : Object | undefined

Gets the cached value for the given key.

key | The key to reference the cached file.
---|---

Returns: The cached file. If the key does not exist undefined is returned.

.remove( key : string )

Removes the cached file associated with the given key.

key | The key to reference the cached file.
---|---

Source

src/loaders/Cache.js