---
title: "Configure the Eviction Policy for a Caching or Valkey Cluster"
method: PUT
path: "/v2/databases/{database_cluster_uuid}/eviction_policy"
tags: ["DigitalOcean-public.v2-new_Databases"]
---

# Configure the Eviction Policy for a Caching or Valkey Cluster

`PUT /v2/databases/{database_cluster_uuid}/eviction_policy`

To configure an eviction policy for an existing Caching or Valkey cluster, send a PUT request to `/v2/databases/$DATABASE_ID/eviction_policy` specifying the desired policy.

## Path parameters

- `database_cluster_uuid` string, uuid, required

## Request body

- object
  - `eviction_policy` 'noeviction' | 'allkeys_lru' | 'allkeys_random' | 'volatile_lru' | 'volatile_random' | 'volatile_ttl', required — A string specifying the desired eviction policy for a Caching or Valkey cluster. - `noeviction`: Don't evict any data, returns error when memory limit is reached. - `allkeys_lru:` Evict any key, least recently used (LRU) first. - `allkeys_random`: Evict keys in a random order. - `volatile_lru`: Evict keys with expiration only, least recently used (LRU) first. - `volatile_random`: Evict keys with expiration only in a random order. - `volatile_ttl`: Evict keys with expiration only, shortest time-to-live (TTL) first.

## Response `204`

The action was successful and the response body is empty.

## Other responses

- `401` — Authentication failed due to invalid credentials.
- `404` — The resource was not found.
- `429` — The API rate limit has been exceeded.
- `500` — There was a server error.
- `default` — There was an unexpected error.

---

[API](https://skmtc.net/digitalocean/apis/digitalocean-api.md) · [All operations](https://skmtc.net/digitalocean/apis/digitalocean-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/digitalocean/digitalocean-api/versions/cb3bf9b21459/schema)
