# CacheVictimContext

Defined in: [packages/cache/src/cache.ts:243](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/cache/src/cache.ts#L243)

What [CacheEvictionPolicy.chooseVictim](/reference/knotkit/cache/interfaces/cacheevictionpolicy/#choosevictim) may consult while it chooses.

## Type Parameters

### K

`K`

## Properties

### protectedKey

> `readonly` **protectedKey**: `K` | `undefined`

Defined in: [packages/cache/src/cache.ts:250](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/cache/src/cache.ts#L250)

The key being set when the cache already holds it, which must not be chosen; `undefined` when the key being set is new. A key that is itself `undefined` is indistinguishable here, so a policy over such keys must not rely on this field to tell the two apart.

***

### isExpired

> `readonly` **isExpired**: (`key`) => `boolean`

Defined in: [packages/cache/src/cache.ts:257](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/cache/src/cache.ts#L257)

Return `true` when the cache holds the key and its entry has expired by the clock reading of the `set` that asked; `false` otherwise, and always without `timeToLive`. An expired victim is dropped without being reported, so returning one first spares a live entry.

#### Parameters

##### key

`K`

#### Returns

`boolean`
