Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
808efd3
inject middleware instead of using router
Boegie19 Oct 12, 2023
7b32656
add warning if route is not found
Boegie19 Oct 12, 2023
2c55dd8
fixed harding api and removed not used stuff
Boegie19 Oct 12, 2023
d0729e2
removed the need to eslint for e2e to run
Boegie19 Oct 12, 2023
708a48d
fix: set proper contentType reference name
derrickmehaffy Nov 12, 2023
b23779d
move provider registration to bootstrap
Boegie19 Nov 12, 2023
5218653
Merge branch 'dev/strapi5' into inject-middleware-instead-of-using-ro…
derrickmehaffy Nov 4, 2024
b6bf53c
Merge pull request #75 from strapi-community/inject-middleware-instea…
derrickmehaffy Nov 4, 2024
9e64081
init v5
Boegie19 Dec 20, 2024
23d49e1
changed editview injectionzones to EditViewSidePanel and DocumentAction
Boegie19 Dec 23, 2024
0fc3e17
fix: getRelatedModelsUid not always being right
Boegie19 Dec 26, 2024
35d7627
enhancement: allow for manual injection of middleware location
Boegie19 Dec 26, 2024
41195a8
fix: don't use instance of use looksLikeInstanceof instead
Boegie19 Dec 26, 2024
4e2e2a1
fix: remove uneeded console.log's
Boegie19 Dec 26, 2024
28b81a5
Core: Update to Strapi 5 stacked (#109)
boazpoolman Sep 5, 2025
ac4a623
manually add changes from #104
derrickmehaffy Sep 5, 2025
612bafc
Merge branch 'main' into dev/strapi5
derrickmehaffy Sep 5, 2025
e7095cd
update readme
derrickmehaffy Sep 5, 2025
7a3108d
prep beta.0 release
derrickmehaffy Sep 5, 2025
6df13d3
fix: patch vitepress-versioning-plugin
boazpoolman Sep 16, 2025
ded01be
chore: updated dependency management for the plugin-rest-cache packag…
boazpoolman Sep 17, 2025
8da56fe
bump packages to stable v5.0.0
derrickmehaffy Sep 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"commonjs": true,
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:import/recommended", "prettier"],
"overrides": [
{
"env": {
"node": true
},
"files": [".eslintrc.{js,cjs}"],
"parserOptions": {
"sourceType": "script"
}
}
],
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"no-undef": "off"
}
}
25 changes: 0 additions & 25 deletions .eslintrc.js

This file was deleted.

40 changes: 19 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,23 @@ name: tests
on:
workflow_call:
push:
branches: [main]
paths:
- ".github/**"
- "data/**"
- "packages/**"
- "playgrounds/**"
- "shared/**"
branches:
- main
- 'dev/**'
pull_request:
branches: [main]
paths:
- ".github/**"
- "data/**"
- "packages/**"
- "playgrounds/**"
- "shared/**"

jobs:
linters:
runs-on: ubuntu-latest

strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: ${{ matrix.node }}

# cache node_modules
- name: Cache dependencies
Expand All @@ -49,13 +41,14 @@ jobs:

e2e_memory:
runs-on: ubuntu-latest
needs: [linters]

strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: ${{ matrix.node }}

# cache node_modules
- name: Cache dependencies
Expand All @@ -75,14 +68,17 @@ jobs:

- run: yarn postinstall:memory

- run: yarn build:plugin:rest-cache

- name: Run Memory e2e tests
working-directory: playgrounds/memory
run: yarn test:e2e

e2e_redis:
runs-on: ubuntu-latest
needs: [linters]

strategy:
matrix:
node: [20, 22]
services:
redis:
image: bitnami/redis:latest
Expand All @@ -96,7 +92,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: ${{ matrix.node }}

# cache node_modules
- name: Cache dependencies
Expand All @@ -116,6 +112,8 @@ jobs:

- run: yarn postinstall:redis

- run: yarn build:plugin:rest-cache

- name: Run Redis e2e tests
working-directory: playgrounds/redis
run: yarn test:e2e
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,11 @@ dist
cache

# Strapi
license.txt
exports
.strapi
dist
build
.strapi-updater.json
.strapi-cloud.json
playgrounds/**/types/*
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14.19.1
v20.18.0
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"endOfLine": "lf",
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"printWidth": 100
}
8 changes: 0 additions & 8 deletions .prettierrc.js

This file was deleted.

26 changes: 14 additions & 12 deletions BENCHMARKS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Benchmarks

These benchmarks are out of date for the current version of the plugin. They are kept here for reference and might be updated in the future.

## Context

- Rest cache version: `4.2.4`
Expand All @@ -15,13 +17,13 @@
$ ENABLE_CACHE=false yarn profile:memory
```

| Stat | 2.5% | 50% | 97.5% | 99% | Avg | Stdev | Max |
| ----------- | ------- | ------- | ------- | ------- | ---------- | --------- | ------- |
| Stat | 2.5% | 50% | 97.5% | 99% | Avg | Stdev | Max |
|-------------|---------|---------|---------|---------|------------|--------|---------|
| **Latency** | 2424 ms | 2555 ms | 2921 ms | 3012 ms | 2565.12 ms | 133.23 | 3401 ms |

| Stat | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min |
| ------------- | --- | ---- | ------ | ------- | ------ | ------ | ------ |
| **Req/Sec** | 0 | 0 | 386 | 1000 | 383.34 | 382.38 | 39 |
| Stat | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min |
|---------------|-----|------|--------|---------|--------|--------|---------|
| **Req/Sec** | 0 | 0 | 386 | 1000 | 383.34 | 382.38 | 39 |
| **Bytes/Sec** | 0 B | 0 B | 453 kB | 1.17 MB | 450 kB | 449 kB | 45.7 kB |

### Cache enabled (without etag)
Expand All @@ -30,12 +32,12 @@ $ ENABLE_CACHE=false yarn profile:memory
$ ENABLE_ETAG=false yarn profile:memory
```

| Stat | 2.5% | 50% | 97.5% | 99% | Avg | Stdev | Max |
| ----------- | ------ | ------ | ------ | ------ | --------- | ------- | ------ |
| Stat | 2.5% | 50% | 97.5% | 99% | Avg | Stdev | Max |
|-------------|--------|--------|--------|--------|-----------|----------|--------|
| **Latency** | 113 ms | 116 ms | 166 ms | 175 ms | 120.04 ms | 12.86 ms | 275 ms |

| Stat | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min |
| ------------- | ------- | ------- | ------- | ------- | ------- | ------ | ------- |
|---------------|---------|---------|---------|---------|---------|--------|---------|
| **Req/Sec** | 7451 | 7523 | 8287 | 8687 | 8293.49 | 306.35 | 6381 |
| **Bytes/Sec** | 8.85 MB | 8.93 MB | 9.84 MB | 10.3 MB | 9.84 MB | 364 kB | 7.57 MB |

Expand All @@ -46,10 +48,10 @@ $ yarn profile:memory
```

| Stat | 2.5% | 50% | 97.5% | 99% | Avg | Stdev | Max |
| ----------- | ------ | ------ | ------ | ------ | --------- | -------- | ------ |
|-------------|--------|--------|--------|--------|-----------|----------|--------|
| **Latency** | 119 ms | 125 ms | 185 ms | 197 ms | 131.05 ms | 16.87 ms | 307 ms |

| Stat | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min |
| ------------- | ------- | ------- | ------- | ------- | ------- | ------ | ------- |
| **Req/Sec** | 6551 | 6559 | 7651 | 8231 | 7599.39 | 472.94 | 6100 |
| Stat | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min |
|---------------|---------|---------|--------|---------|---------|--------|--------|
| **Req/Sec** | 6551 | 6559 | 7651 | 8231 | 7599.39 | 472.94 | 6100 |
| **Bytes/Sec** | 8.05 MB | 8.07 MB | 9.4 MB | 10.1 MB | 9.34 MB | 581 kB | 7.5 MB |
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Copyright (c) 2022 Strapi Community.
Copyright (c) 2025 Strapi Community.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<p style="margin-top: 0;">Speed-up HTTP requests with LRU cache.</p>

<p>
<a href="https://www.npmjs.org/package/strapi-plugin-rest-cache">
<img src="https://img.shields.io/npm/v/strapi-plugin-rest-cache/latest.svg" alt="NPM Version" />
<a href="https://www.npmjs.org/package/@strapi-community/plugin-rest-cache">
<img src="https://img.shields.io/npm/v/@strapi-community/plugin-rest-cache/latest.svg" alt="NPM Version" />
</a>
<a href="https://www.npmjs.org/package/strapi-plugin-rest-cache">
<img src="https://img.shields.io/npm/dm/strapi-plugin-rest-cache" alt="Monthly download on NPM" />
<a href="https://www.npmjs.org/package/@strapi-community/plugin-rest-cache">
<img src="https://img.shields.io/npm/dm/@strapi-community/plugin-rest-cache" alt="Monthly download on NPM" />
</a>
</p>
</div>
Expand All @@ -17,15 +17,14 @@

- [🚦 Current Status](#-current-status)
- [✨ Features](#-features)
- [🤔 Motivation](#-motivation)
- [🖐 Requirements](#-requirements)
- [🚚 Getting Started](#-getting-started)
- [Contributing](#contributing)
- [License](#license)

## 🚦 Current Status

This package is currently under development and should be consider **ALPHA** in terms of state. I/We are currently accepting contributions and/or dedicated contributors to help develop and maintain this package.
This package is currently under development and should be consider **BETA** in terms of state. I/We are currently accepting contributions and/or dedicated contributors to help develop and maintain this package.

## ✨ Features

Expand All @@ -38,21 +37,20 @@ You can set a **strategy** to tell what to cache and how much time responses sho

Supported Strapi Versions:

- Strapi v4.0.x (recently tested as of January 2022)
- Strapi v4.1.x (recently tested as of March 2022)
- Strapi v4.x.x (Assumed, but possibly not tested)
- Strapi v5.x.x (recently tested as of September 2025)

**If you are looking for the Strapi v4.x support, please check the [legacy package](https://www.npmjs.com/package/strapi-plugin-rest-cache).**
**If you are looking for a plugin for Strapi v3.x, please check the [strapi-middleware-cache](https://github.com/patrixr/strapi-middleware-cache/).**

## 🚚 Getting Started

[Read the Docs to Learn More.](https://strapi-community.github.io/strapi-plugin-rest-cache/)
[Read the Docs to Learn More.](https://strapi-community.github.io/plugin-rest-cache/)

## Contributing

I/We are actively looking for contributors, maintainers, and others to help shape this package. As this plugins sole purpose within the Strapi community is to be used by other developers and plugin maintainers to get fast responses time.

If interested please feel free to email the lead maintainer Sacha at: [email protected] or ping `stf#3254` on Discord.
If interested please feel free to open an issue or pull request.

## License

Expand Down
29 changes: 29 additions & 0 deletions docs/.vitepress/components/LegacyWarning.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script setup lang="ts">
import { useData, useRoute } from 'vitepress'
import { computed } from 'vue'

const { site } = useData()
const route = useRoute()

// Define which versions should show the legacy warning
const legacyVersions = ['4.x.x']

// Check if current URL starts with any version folder name
const shouldShowWarning = computed(() => {
const path = route.path
return legacyVersions.some(version => path.startsWith(`${site.value.base}${version}/`))
})
</script>

<template>
<div v-if="shouldShowWarning" class="warning custom-block">
<p class="custom-block-title">WARNING</p>
<p>You're looking at the old Rest Cache plugin documentation for <strong>Strapi v4</strong>. Documentation for Strapi v5 can be <a :href="`${site.base}guide/`">found here</a>.</p>
</div>
</template>

<style scoped>
.warning {
margin-bottom: 2rem;
}
</style>
Loading
Loading