Class: MemoryByteCache
Defined in: memory-cache.ts:44
The default ByteCache: contiguous spans in memory, looked up by containment, with one LRU budget per Purpose so data churn can never evict metadata spans. A read is served from any span that contains it, whichever purpose fetched it; the purpose only decides which budget a stored span counts against. A span larger than its budget, or empty, is not stored. A span contained in a stored span is dropped; stored spans the new span contains are replaced by it. Partial overlaps are kept side by side and are misses for a read that straddles them.
Implements
Constructors
Constructor
new MemoryByteCache(
options?):MemoryByteCache
Defined in: memory-cache.ts:49
Parameters
options?
dataBytes?
number
metadataBytes?
number
Returns
MemoryByteCache
Methods
byteSize()
byteSize(
purpose):number
Defined in: memory-cache.ts:135
Bytes currently held for purpose, when the cache can tell.
Parameters
purpose
Returns
number
Implementation of
delete()
delete(
file):Promise<void>
Defined in: memory-cache.ts:139
Drop every span of file. The reader calls this when a response shows
the object was replaced, so a cache without it keeps serving the old
bytes after a change.
Parameters
file
Returns
Promise<void>
Implementation of
get()
get(
file,range,_purpose):Promise<Uint8Array<ArrayBufferLike> |undefined>
Defined in: memory-cache.ts:56
The bytes of range if one stored span contains all of it.
Parameters
file
range
_purpose
Returns
Promise<Uint8Array<ArrayBufferLike> | undefined>
Implementation of
put()
put(
file,offset,bytes,purpose):Promise<void>
Defined in: memory-cache.ts:82
Store a received span. The cache decides what to keep and for how long.
Parameters
file
offset
number
bytes
purpose
Returns
Promise<void>