@proto-kit/common β€’ Docs


Documentation / @proto-kit/common / ProxyCache

Class: ProxyCache

Implements

  • Cache

Constructors

new ProxyCache()

new ProxyCache(): ProxyCache

Returns

ProxyCache

Properties

canWrite

canWrite: boolean = true

Indicates whether the cache is writable.

Implementation of

O1Cache.canWrite

Defined in

packages/common/src/cache/ProxyCache.ts:8


debug

debug: boolean = false

If debug is toggled, read() and write() errors are logged to the console.

By default, cache errors are silent, because they don’t necessarily represent an error condition, but could just be a cache miss, or file system permissions incompatible with writing data.

Implementation of

O1Cache.debug

Defined in

packages/common/src/cache/ProxyCache.ts:10

Methods

getLog()

getLog(): string[]

Returns

string[]

Defined in

packages/common/src/cache/ProxyCache.ts:21


read()

read(header): undefined | Uint8Array

Read a value from the cache.

Parameters

β€’ header: CacheHeader

A small header to identify what is read from the cache.

Returns

undefined | Uint8Array

Implementation of

O1Cache.read

Defined in

packages/common/src/cache/ProxyCache.ts:12


startLog()

startLog(): void

Returns

void

Defined in

packages/common/src/cache/ProxyCache.ts:25


write()

write(header, value): void

Write a value to the cache.

Parameters

β€’ header: CacheHeader

A small header to identify what is written to the cache. This will be used by read() to retrieve the data.

β€’ value: Uint8Array

The value to write to the cache, as a byte array.

Returns

void

Implementation of

O1Cache.write

Defined in

packages/common/src/cache/ProxyCache.ts:16