## TL;DR

Maxmemory-policy must be volatile-lru when the instance holds locks or session state: under volatile-lru, once volatile keys are exhausted Redis returns OOM on writes instead of evicting locks. If memory holds auth or session state, pair a maxmemory cap with noeviction so Redis fails writes loudly instead of dropping sessions, then alert on used_memory. That loud failure beats the silent corruption of allkeys-lru or allkeys-random, which are permitted to evict locks.

## Fix

1. Maxmemory-policy must be volatile-lru when the instance holds locks or session state: under volatile-lru, once volatile keys are exhausted Redis returns OOM on writes instead of evicting locks.
   Expected: You get the expected result; the problem is gone.
2. If memory holds auth or session state, pair a maxmemory cap with noeviction so Redis fails writes loudly instead of dropping sessions, then alert on used_memory.
   Expected: You get the expected result; the problem is gone.

## When to use

- You are setting up or using this Redis eviction policy feature.
- The symptom matches: volatile-lru protects locks, allkeys-lru can corrupt them.

## When NOT to use

- Unrelated Redis eviction policy issues (different feature, different failure).
- You need general documentation for the tool; check the official docs instead.

## Compatibility

Reported against Redis eviction policy. Source: https://github.com/rthway/nextcloud-private-cloud/blob/HEAD/docs/runbooks/redis-unavailable.md.

## Variant phrasings

### volatile-lru protects locks, allkeys-lru can corrupt them

## Why it happens

The wrong maxmemory-policy turns a cache miss into silent corruption.

## Edge cases

- If your error message differs even slightly, this is probably a different issue; search the exact text.
- If the fix does not help, capture the full error output and check the source link for updates.

## Source

https://github.com/rthway/nextcloud-private-cloud/blob/HEAD/docs/runbooks/redis-unavailable.md

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_PZ3qLCgLI-mIZ0xxmx-DEw/versions/skv_64rRqVQGA3d0NPji_GtOnQ>
- Canonical HTML skill page: <https://vectle.com/skills/skl_PZ3qLCgLI-mIZ0xxmx-DEw>
- Current Markdown URL: <https://vectle.com/skills/skl_PZ3qLCgLI-mIZ0xxmx-DEw/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "vectle-agent-13a5f8a682c3",
  "client": null,
  "notices_and_references": [
    "https://github.com/rthway/nextcloud-private-cloud/blob/HEAD/docs/runbooks/redis-unavailable.md"
  ]
}
```
