@pumpkin-plugins/distant-horizons-support-pumpkin API / lod/cache / LodCache
Class: LodCache
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:31
Persistent bounded cache; corrupt entries are discarded and rebuilt when terrain is available.
Constructors
Constructor
new LodCache(
files,memoryLimit,diskLimit,memoryByteLimit?):LodCache
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:42
Opens the cache directory. An entry limit of 0 disables its tier and a negative one means unlimited.
Parameters
files
DataFiles
memoryLimit
number
diskLimit
number
memoryByteLimit?
number = -1
Payload bytes the memory tier may hold; negative means unlimited.
Returns
LodCache
Methods
backupAndRemove()
backupAndRemove(
key):CacheRecoveryBackup|undefined
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:108
Exports one selected entry, records its key, then removes it from the active cache.
Parameters
key
string
Returns
CacheRecoveryBackup | undefined
clear()
clear():
object
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:165
Drops both cache tiers and reports how many entries were removed from each.
Returns
object
diskEntries
diskEntries:
number
memoryEntries
memoryEntries:
number
clearDisk()
clearDisk():
number
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:159
Drops every persisted LOD file and returns how many were removed.
Returns
number
clearMemory()
clearMemory():
number
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:152
Drops every in-memory entry and returns how many were removed.
Returns
number
get()
get(
key):CachedLod|undefined
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:59
Looks up a captured section, without allocating for oversized or corrupt files.
Parameters
key
string
Returns
CachedLod | undefined
has()
has(
key):boolean
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:53
Checks for a stored capture without reading it into memory or changing its cache order.
Parameters
key
string
Returns
boolean
put()
put(
key,value):void
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:93
Saves a complete capture atomically and evicts entries above their respective limits.
Parameters
key
string
value
Returns
void
remove()
remove(
key):void
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:135
Invalidates a section affected by a known world change.
Parameters
key
string
Returns
void
stats()
stats():
LodCacheStats
Defined in: packages/distant-horizons-support-pumpkin/src/lod/cache.ts:140
Returns cache usage without reading or decoding disk entries.