Skip to main content

Interface: CacheImplementation<E>

Type parameters

NameType
Eunknown

Properties

get

get: (key: string, call: ProtoCatCall<E, Message, Message, Unary>) => undefined | Buffer | Promise<undefined | Buffer>

Type declaration

▸ (key, call): undefined | Buffer | Promise<undefined | Buffer>

Return buffer from cache. Returning falsy value is considered a cache miss.

Parameters
NameType
keystring
callProtoCatCall<E, Message, Message, Unary>
Returns

undefined | Buffer | Promise<undefined | Buffer>

Defined in

lib/server/middleware/cache.ts:15


hash

hash: (call: ProtoCatCall<E, Message, Message, Unary>) => undefined | string | Promise<undefined | string>

Type declaration

▸ (call): undefined | string | Promise<undefined | string>

Create a unique cache key that will be used for response save and lookup.

Return falsy key if caching should be skipped

Parameters
NameType
callProtoCatCall<E, Message, Message, Unary>
Returns

undefined | string | Promise<undefined | string>

Defined in

lib/server/middleware/cache.ts:11


set

set: (key: string, value: Buffer, call: ProtoCatCall<E, Message, Message, Unary>) => void

Type declaration

▸ (key, value, call): void

Set cache result. Result is not awaited and does not block the response nor subsequent requests

Parameters
NameType
keystring
valueBuffer
callProtoCatCall<E, Message, Message, Unary>
Returns

void

Defined in

lib/server/middleware/cache.ts:20