Interface: ByteCache
Defined in: types.ts:87
Where received byte spans live. The default is MemoryByteCache; a user can supply a disk-backed one. Both methods are asynchronous so a cache can live outside memory. A cache only holds bytes: in-flight requests and the not-found outcome stay in the reader.
Methods
byteSize()?
optionalbyteSize(purpose):number
Defined in: types.ts:102
Bytes currently held for purpose, when the cache can tell.
Parameters
purpose
Returns
number
delete()?
optionaldelete(file):Promise<void>
Defined in: types.ts:108
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>
get()
get(
file,range,purpose):Promise<Uint8Array<ArrayBufferLike> |undefined>
Defined in: types.ts:89
The bytes of range if one stored span contains all of it.
Parameters
file
range
purpose
Returns
Promise<Uint8Array<ArrayBufferLike> | undefined>
put()
put(
file,offset,bytes,purpose):Promise<void>
Defined in: types.ts:95
Store a received span. The cache decides what to keep and for how long.
Parameters
file
offset
number
bytes
purpose
Returns
Promise<void>