# CacheEvictionPolicyFactory

> **CacheEvictionPolicyFactory**<`K`> = (`capacity`) => [`CacheEvictionPolicy`](/reference/knotkit/cache/interfaces/cacheevictionpolicy/)<`K`>

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

Build one cache’s [CacheEvictionPolicy](/reference/knotkit/cache/interfaces/cacheevictionpolicy/). Called once per cache, at construction and after the options are validated, with the validated `capacity`: in entries without `weigh`, in weight with it.

## Type Parameters

### K

`K`

## Parameters

### capacity

`number`

## Returns

[`CacheEvictionPolicy`](/reference/knotkit/cache/interfaces/cacheevictionpolicy/)<`K`>
