Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

configure-rest-cache

/configure-rest-cache

Dobiera i zapisuje konfigurację Strapi REST Cache: co cache'ować i na jak długo, provider memory lub Redis, odpowiedzi uwierzytelnione i per język oraz klucze cache.

Licencja
MIT
Ostatnia zmiana repozytorium
12.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
9
Przestarzałość

Brak sygnałów. Repozytorium zmienione 12.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Dobiera i zapisuje konfigurację Strapi REST Cache: co cache'ować i na jak długo, provider memory lub Redis, odpowiedzi uwierzytelnione i per język oraz klucze cache.

Oryginalny opis (EN)

Choose and write a Strapi REST Cache configuration for a specific use case. Use when setting up @strapi-community/plugin-rest-cache, deciding what to cache and for how long, picking between the memory and redis providers, caching authenticated or per-locale responses, or tuning cache keys.

Jak działa

  1. Establish first
  2. Then pick a starting point
  3. Rules that are not negotiable
  4. Sanity-check the result
  5. Writing the config
Sekcje z nagłówków SKILL.md, w oryginale · 82 linii, 512 słów
Podgląd SKILL.md
---
name: configure-rest-cache
description: Choose and write a Strapi REST Cache configuration for a specific use case. Use when setting up @strapi-community/plugin-rest-cache, deciding what to cache and for how long, picking between the memory and redis providers, caching authenticated or per-locale responses, or tuning cache keys.
---

# Configuring REST Cache

Do not write a configuration before establishing the four things below. Most
bad cache configurations are bad because one of them was assumed.

## Establish first

1. **How many Strapi instances run in production?** More than one means the
   memory provider is wrong — each process would hold its own cache and a purge
   would only reach one of them. That decision is not tunable later without
   changing infrastructure.
2. **Is the traffic public, authenticated, or both?** Authenticated caching is
   safe only with per-caller keys, and is off by default for that reason.
3. **Which routes actually hurt?** Caching everything is rarely the goal.
   A few expensive endpoints often account for most of the load.
4. **How stale may content be?** Usually the answer is "it may not be" — which
   is fine, because invalidation is automatic. `maxAge` is a backstop for
   changes nothing observed, not the primary mechanism.

Ask the user these if the answers are not already evident from their project.

## Then pick a starting point

Each of these is a complete, copy-pasteable configuration with the trade-offs
written out. Prefer sending the user to the matching one over inventing a
config from scratch.

| Situation | Recipe |
| --- | --- |
| Public, read-heavy content API | [public-content](https://strapi-community.github.io/plugin-rest-cache/guide/recipes/public-content.html) |
| Per-user or token-authenticated responses | [authenticated](https://strapi-community.github.io/plugin-rest-cache/guide/recipes/authenticated.html) |
| Several instances behind a load balancer | [multi-instance](https://strapi-community.github.io/plugin-rest-cache/guide/recipes/multi-instance.html) |
| Only a few slow endpoints | [expensive-routes](https://strapi-community.github.io/plugin-rest-cache/guide/recipes/expensive-routes.html) |
| i18n, or heavy filter/pagination/populate use | [i18n-and-query](https://strapi-community.github.io/plugin-rest-cache/guide/recipes/i18n-and-query.html) |
| Preview or draft workflows | [previews-drafts](https://strapi-community.github.io/plugin-rest-cache/guide/recipes/previews-drafts.html) |

Full option reference:
https://strapi-community.github.io/plugin-rest-cache/guide/reference/config.html

## Rules that are not negotiable

**Durations are milliseconds.** `maxAge: 3600` is 3.6 seconds. One hour is
`3600000`. Write the value with a comment saying what it is in human units.

**Never set `hitpass: false` without `keys.useAuth: true`.** Together they
cache authenticated traffic keyed per caller. `hitpass: false` alone means two
callers authorised for the same route share one entry, and whoever misses first
decides what everybody else sees. The server logs a warning at boot if you do
this, and the admin panel flags the content type — but by then it is already
serving.

**Custom route paths must include the API prefix**, exactly as Strapi
registered them: `/api/articles/slug/:slug`.

**Match `keysPrefix` to your Redis `keyPrefix`** if the connection sets one.
A mismatch means the plugin enumerates nothing, and every purge silently does
nothing.

## Sanity-check the result

Have the user turn on `enableXCacheHeaders`, then:

```bash
curl -sI http://localhost:1337/api/articles | grep -i x-cache   # MISS
curl -sI http://localhost:1337/api/articles | grep -i x-cache   # HIT
```

Then edit that content in the admin panel and request again — it should be
`MISS`, proving invalidation works.

`HITPASS` means the request bypassed the cache; with the default `hitpass` a
browser session will always do that. Test with `curl`.

If any of that does not behave, switch to the `diagnose-rest-cache` skill.

## Writing the config

Both `./config/plugins.js` and `./config/plugins.ts` are supported. Match
whichever the project already uses, and keep the plugin's block under the
`rest-cache` key with everything inside `config`.

Wersje

W bazie nie ma innych skilli o nazwie configure-rest-cache.

Migawka bazy z 13.11.2026 · wersja paczki 4cf591cd12b1 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100diagnose-rest-cache
    Diagnozuje, dlaczego Strapi REST Cache nie cache'uje, serwuje przestarzałą treść lub cache'uje niewłaściwe dane: MISS i HITPASS w X-Cache, nieaktualna treść po edycji i dane jednego użytkownika widoczne dla innego.
  • 100strapi
    Pomaga stawiać projekt Strapi 5, modelować typy treści, odpytywać API REST z Next.js lub innego frontendu, dostosowywać kontrolery i trasy oraz migrować ze Strapi 4.
  • 100caching
    Opisuje strategie cache'owania: unieważnianie, zalecenia TTL, klucze, warstwy cache i sytuacje, w których nie warto cache'ować.
  • 90FastAPI Caching
    Podaje wzorce cache'owania w FastAPI z Redisem: cache odpowiedzi API, unieważnianie cache, warstwa cache i optymalizacja wydajności.
  • 100strapi-plugin-dev
    Pomaga tworzyć, refaktoryzować i naprawiać wtyczki Strapi v5: własne API, rozszerzenia panelu admina i typy treści.
  • 100caching-strategy
    Prowadzi zmiany w cache, od pamięci podręcznej po nagłówki HTTP, Redis i CDN, tak aby opisać, co jest buforowane, na jak długo i co je unieważnia.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.