Coder Social home page Coder Social logo

strapi-community / strapi-plugin-rest-cache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patrixr/strapi-middleware-cache

114.0 5.0 24.0 6.24 MB

Speed-up HTTP requests with LRU cache.

Home Page: https://strapi-community.github.io/strapi-plugin-rest-cache/

License: MIT License

JavaScript 100.00%
cache strapi rest

strapi-plugin-rest-cache's Introduction

Strapi REST Cache Plugin

Speed-up HTTP requests with LRU cache.

NPM Version Monthly download on NPM

Table of Contents

๐Ÿšฆ 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.

โœจ Features

This plugin provide a way to cache HTTP requests in order to improve performance. It's get inspired by varnish cache which is a popular caching solution.

The cache content is stored by a provider, which can be either an in-memory provider, a redis connection, a file system, or any other custom provider. You can set a strategy to tell what to cache and how much time responses should be cached. The cache will be invalidated when the related Content-Type is updated, so you never have to worry about stale data.

๐Ÿ– Requirements

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)

If you are looking for a plugin for Strapi v3.x, please check the strapi-middleware-cache.

๐Ÿšš Getting Started

Read the Docs to Learn More.

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.

License

See the LICENSE file for licensing information.

strapi-plugin-rest-cache's People

Contributors

azhrak avatar bartzy avatar benjenkyn avatar blefevre avatar boazpoolman avatar boegie19 avatar comfortablycoding avatar davidepellegatta avatar dependabot[bot] avatar derrickmehaffy avatar dinhkhanh avatar dvspandey avatar joacimastrom avatar lorenzoceglia avatar meck93 avatar molund avatar nystrand1 avatar patrixr avatar rubenmkindapp avatar rubms avatar sgarcia-g avatar stafyniaksacha avatar tomekzar avatar v1nn1k avatar vhnam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

strapi-plugin-rest-cache's Issues

get Keys for redis cache does not work

When the "prefix" value comes in as "undefined" it is added to the query for keys and it returns an empty array becuase there is no key with the name "undefined{{the-rest-of-the-key}}".

currently added a customer provider with the fix

async keys(prefix) {
return prefix ? this.cache.keys(${prefix}*) : this.cache.keys('*');
}

Need path option in config. But not described in docs

$ yarn build
yarn run v1.22.19
$ strapi build
Building your admin UI with development configuration...
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:393:5)
at validateString (node:internal/validators:161:11)
at Object.resolve (node:path:1098:7)
at /home/rom/Documents/Projects/test/citizenscience.ru/node_modules/@strapi/admin/utils/create-cache-dir.js:82:33
at Array.filter ()
at createCacheDir (/home/rom/Documents/Projects/test/citizenscience.ru/node_modules/@strapi/admin/utils/create-cache-dir.js:80:6)
at async Object.build (/home/rom/Documents/Projects/test/citizenscience.ru/node_modules/@strapi/admin/index.js:27:3)
at async module.exports (/home/rom/Documents/Projects/test/citizenscience.ru/node_modules/@strapi/strapi/lib/commands/build.js:12:3) {
code: 'ERR_INVALID_ARG_TYPE'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Caching not only 'factory' content types

Discussed in #29

Originally posted by niddu85 September 28, 2022
Hello,
I'm trying to cache results from strapi-plugin-navigation but I'm not able to properly configure the cache plugin since it needs the content type name to cache (eg api::button.button )
Is there anyone that was able to configure it properly?

On top of this discussion is there a way to get content types created by plugins to be cached?

I am also interested in the specific navigation plugin and rest cache interaction, but if someone has a more generic solution also for all kinds of content types (or costum routes created by strapi cli) that would be highly appriciated!

Just for discussions sake the content types generated by this specific plugin are:

  • plugin::navigation.audiance
  • plugin::navigation.navigation
  • plugin::navigation.navigation-item
  • plugin::navigation.navigation-item-related

And the route I am specifically interested in: /api/navigation/render/:uid

Seting up
the stragegy like
strategy: { contentTypes: [ { contentType: 'plugin::navigation.navigation', routes: [{ path: '/api/navigation/render/:uid', method: 'GET' }], }, ..... ]}

or
strategy: { contentTypes: [ 'plugin::navigation.navigation', ..... ]}

did nothing sadly.

It is totally fine if this is a feature request, but if this should work even now than I think the documentation should cover this.

Connect a plugin with sentinels 3 nodes

I want to connect a plugin with sentinels 3 nodes Is this possible? like here https://github.com/strapi-community/strapi-plugin-redis

How I should connect with sentinels?
I tried
redis: {
config: {
connections: {
default: {
connections: {
sentinels: [{ {host: "master", port: 6379}, {host: "sentinel" port: 6379}].
and
"rest-cache": {
config: {
provider: {
name: 'redis',
options: {
max: 32767,
connection: 'default'
}
,
},

It gives the error that connection default not found.
image

Strapi Rest Cache Plugin Is Not Working

Required System information

  • Node.js version: 18.18.2
  • NPM version: 9.6.6
  • Strapi version: 4.15.0
  • Database: postgres
  • Operating system: Windows
  • Is your project Javascript or Typescript: Typescript

Describe the bug

I was implementing the Rest API's in the my Strapi Application but i was not satisfied with the time it taking to fetch the Database and I hosted the database RDS in amazon and the Strapi too in the same region so there is no issue related to the region it hosted but when i am trying to get it in local it also takes a lil bit more time like 2 sec for a simple images and all. So I Find in Strapi forum to use the Rest Cache Plugin But I Followed full documentation but the plugin did not start. I don't know why it is not getting started. Can anyone pls look into this matter.

Steps to reproduce the behavior

image

Plugin.Ts Code -:

export default ({ env }) => ({
  redis: {
    config: {
        connections: {
            default: {
                connection: {
                    host: '127.0.0.1',
                    port: 6379,
                    db: 0,
                },
                settings: {
                    debug: false,
                },
            },
        },
    },
},
"rest-cache": {
    config: {
        provider: {
            name: "redis",
            options: {
                max: 32767,
                connection: "default",
            },
        },
        strategy: {
            
            enableEtagSupport: true,
            logs: true,
            clearRelatedCache: true,
            maxAge: 3600000,
            contentTypes: [
                "api::popular-course.popular-course",
                {
                    contentType: "api::popular-course.popular-course",
                    maxAge: 3600000,
                    hitpass: false,
                    keys: {
                        useQueryParams: false,
                        useHeaders: ["accept-encoding"],
                    },
                    method: "GET",
                }
            ],
        },
    },
},
};

Expected Behaviour:

image

This Button Should Appear In The CMS but Its Not Getting Appeared Pls Look Into This Guys

PLEASE LET ME KNOW IF ANY OTHER CLEARIFICATION IS REQUIRED

This is what i am getting after all that configuratin and by calling the api multiple times

Documentation: authorized calls & caching

This chapter has no content, but I am trying to figure out a way to cache authorized calls. Can anyone point me in a general direction to cache authorized calls (without setting hitmiss to false).

And setting a key based on ctx, is that maybe that could be considered as a feature? For example: use the role id of the user to create a caching key.

Admin purge cache buttons are not clearing cache entries

Based on the redis playground using a 3 node replication Redis "cluster": Master + 2 Slaves + 3 Sentinels

I've made the following requests:

  • /api/articles
  • /api/articles?populate=*
  • /api/articles/1
  • /api/articles/1?populate=*

And I've tested the two main buttons within the admin:

  • on the list view to purge all keys
  • on the entity (ID 1) view to purge all of the keys for entity

None of the keys were purged:

image

Expectation would be the list view purge should purge all keys with a wildcard of /api/articles* and the entity should purge all keys with a wildcard of /api/articles/1*

(tested using latest master as of commit: 2adb76b)

Is it possible to disable logs?

Is it possible to disable the cache logs similar to how the strapi-middleware-cache does it? strapi-middleware-cache has a logs parameter in the config object, does this plugin have such a feature?

This plugin is not working

Unless I'm doing something wrong I don't see this plugin working...
I followed the steps under the getting started page, and nothing happened.

I also tried using in memory and also redis.

Caching issue

when I update entry in strapi ui and save I need to purge REST cache every time else changes will not be reflected. Same goes with creating an entry. Can it happen automatically?

Cache is not working

I have followed the docs. I just execute with DEBUG=strapi:* yarn develop, but I dont have headers or logs about caching.

config/plugins.js

module.exports = {
  "strapi-plugin-rest-cache": {
    config: {
      provider: {
        name: "memory",
        options: {
          max: 32767,
          maxAge: 3600,
        },
      },
      strategy: {
        enableXCacheHeaders: true,
        contentTypes: [
          "api::restaurant.restaurant",
        ],
      },
    },
  },
};

Cache-Control header is not set in response.

As the title, I don't see any cache instruction headers like Cache-Control: in the API response.
my current configuration:

"rest-cache": {
    config: {
      provider: {
        name: "memory",
        options: {
          max: 32767,
          maxAge: 3600,
        },
      },
      strategy: {
        maxAge: 3600000,
        contentTypes: [
          // list of Content-Types UID to cache
          "api::category.category",
          "api::printer.printer",
          "api::supporter.supporter",
          "api::seller.seller",
        ],
        enableEtag: true,
        hitpass() {
          return false;
        },
      },
    },
}

Strategy documentation should show "hitpass: false" by default

We ran into a very tricky debugging scenario where:

a. hitpass wasn't set in our configuration
b. We had cookies in our requests because we had been using the same browsers to access the Strapi admin site

The result was that the cache appeared to be invalidating properly when tested from the browser, but actually the browser was bypassing the cache due to the default hitpass setting, which returns true if there is a cookie in the request:

function hitpass(ctx) {
  // ignore cache when authorization or cookie headers are present
  return Boolean(
    ctx.request.headers.authorization || ctx.request.headers.cookie
  );
}

The default hitpass behaviour also made it very difficult to confirm that Redis was working locally because I mistakenly used the browser with a cookie to call the rest api as part of my test.

Changing the default behaviour would be a breaking change, so I am suggesting changing all the examples in the documentation instead so they include hitpass: false.

e.g.
hitpass: false, // remove this setting to bypass the cache if authorization or cookie headers are present

Need path option in config. But not described in docs

$ yarn build
yarn run v1.22.19
$ strapi build
Building your admin UI with development configuration...
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:393:5)
at validateString (node:internal/validators:161:11)
at Object.resolve (node:path:1098:7)
at /home/rom/Documents/Projects/test/citizenscience.ru/node_modules/@strapi/admin/utils/create-cache-dir.js:82:33
at Array.filter ()
at createCacheDir (/home/rom/Documents/Projects/test/citizenscience.ru/node_modules/@strapi/admin/utils/create-cache-dir.js:80:6)
at async Object.build (/home/rom/Documents/Projects/test/citizenscience.ru/node_modules/@strapi/admin/index.js:27:3)
at async module.exports (/home/rom/Documents/Projects/test/citizenscience.ru/node_modules/@strapi/strapi/lib/commands/build.js:12:3) {
code: 'ERR_INVALID_ARG_TYPE'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Track cache hits

Does the middleware currently keep track of the number of hits / served responses per cached entry or content type that I could access? I previously implemented a basic module for request statistics that obviously breaks when the caching plugin is used as the requests never hit the endpoint that would typically be called by clients.

Is there a way to determine the order of middlewares that get run before the caching middleware is executed?

Implement RFC-01 for changing the way cache middlewares are injected into the application

See the following RFC: #64

Suggestion is to remove middleware injection via koa-router copy and mutation and use native Strapi APIs instead that are officially supported and recommended by the Strapi Team.

Tasks

Cannot purge in Windows

Cache keys are generated incorrectly when deploying strapi in Windows. When I use the purge button, the key is not matched and therefore the cache for the REST entry is never purged.

const requestPath = toLower(path.normalize(ctx.request.path)).replace(

If I replace this code with this:
const requestPath = toLower(ctx.request.path).replace( /\/$/, '' );
Then the purge works fine.

purgeAdmin should also send request.body to cacheStore.clearByUid

Hey team!

I believe the purgeAdmin function should also include ctx.request.body on the params that's sent to cacheStore.clearByUid allowing for url paths that include more than just the id.

Reasoning for that is that today when you hit save on the admin, the params object only include the id of the object, only purging urls that include :id as a result and not working for :slug or other cases, so this example here: https://strapi-community.github.io/strapi-plugin-rest-cache/guide/strategy/cache-custom-routes.html#frontmatter-title does't seem to be purged when hitting save, only when you explicitly click Purge REST Cache on the entity (that already adds the whole object to the cacheStore.clearByUid call).

Here's the change I did that seem to fix the issue:

diff --git a/node_modules/strapi-plugin-rest-cache/server/middlewares/purgeAdmin.js b/node_modules/strapi-plugin-rest-cache/server/middlewares/purgeAdmin.js
index 483a4de..5c24461 100644
--- a/node_modules/strapi-plugin-rest-cache/server/middlewares/purgeAdmin.js
+++ b/node_modules/strapi-plugin-rest-cache/server/middlewares/purgeAdmin.js
@@ -29,7 +29,10 @@ function createPurgeAdmin(options, { strapi }) {
 
     if (!(ctx.status >= 200 && ctx.status <= 300)) return;
 
-    await cacheStore.clearByUid(uid, params);
+    await cacheStore.clearByUid(uid, {
+      ...params,
+      ...ctx.request.body,
+    });
   };
 }
 

This issue body was partially generated by patch-package.

Let me know if that looks good to you guys and I can also send a PR with this.

Redis Cache Does not Seem to do anything

On the latest version of the associated plugins I think

Current strapi version 4.1.7
node v14

"strapi-plugin-redis": "^1.0.0-alpha.2",
"strapi-plugin-rest-cache": "^4.2.4",
"strapi-provider-rest-cache-redis": "^4.2.4",

with a configuration block that looks like this

    redis: {
      config: {
        connections: {
          default: {
            connection: {
              host: process.env.REDIS_HOST,
              port: process.env.REDIS_PORT,
              db: process.env.REDIS_DB,
              password: process.env.REDIS_PW
            },
            settings: {
              debug: false,
              enableEtag: true,
              enableXCacheHeaders: true,
              resetOnStartup: true
            },
          },
        },
      },
    },
    'rest-cache': {
      config: {
        provider: {
          name: "redis",
          options: {
            max: 32767,
            connection: "default",
          },
        },
        strategy: {
          contentTypes: [
            "api::article.article",
          ],
        },
      },
    },

However this does not seem to do anything, nothing is being cached in redis and I am not sure why

rest-cache is not aware of transformer plugin (or vice versa)

Thanks for an awesome plugin :-)

When using strapi-plugin-transformer and rest-cache plugin only the first request from api is transformed. Subsequent and therefore cached api requests are not transformed.

Strapi 4.2.0
strapi-plugin-transformer 2.0.2 (Latest NPM)
strapi-plugin-rest-cache 4.2.4
strapi-plugin-rest-cache-provider-memory 4.2.4
Node 14 + 16

I have tried different orders in the plugins.js and different settings for each plugin, but it makes no difference. I have also tried disabling all other plugins (sentry, aws-upload, email).

It seems that somehow the rest-cache plugin is not aware of the transformer plugins transformations before storing it in cache.

Here are my rest-cache settings:

  "rest-cache": {
    config: {
      provider: {
        name: "memory",
        getTimeout: 500,
        options: {
          max: 32767,
          updateAgeOnGet: false,
          // maxAge: env("MAX_AGE", 60000),
        },
      },
      strategy: {
        contentTypes: [
          // list of Content-Types UID to cache
          "api::competition.competition",
          "api::photo.photo",
          "api::photographer.photographer",
        ],
      },
    },
  },

And the strapi-plugin-transformer settings:

  transformer: {
    enabled: true,
    config: {
      prefix: "/api/",
      responseTransforms: {
        removeAttributesKey: true,
        removeDataKey: true,
      },
    },
  },

Bulk Publish/Unpublish: Cache not busted

The cache doesn't seem to be busted when performing a bulk publish/unpublish operation via the strapi admin collection 'list view'. Cache is busted correctly when updating entries individually in the 'detail' view, including when Publishing/unpublishing. Anyone else experiencing this?

My ./src/config/plugins.ts config:

module.exports = {
  "drag-drop-content-types": {...},
  seo: {...},
  ckeditor: {...},
  graphql: {
    enabled: true,
    playgroundAlways: true,
  },
  "rest-cache": {
    enabled: true,
    config: {
      provider: {
        name: "memory",
        options: {
          max: 32767,
          maxAge: 3600,
        },
      },
      strategy: {
        debug: true,
        enableEtag: true,
        enableXCacheHeaders: true,
        enableAdminCTBMiddleware: true,
        clearRelatedCache: true,
        contentTypes: [
          // list of Content-Types UID to cache
          "api::post.post",
        ],
      },
    },
  },
};

"@strapi/strapi": "4.13.2",
"pg": "8.11.3",
"strapi-plugin-rest-cache": "^4.2.8"

Plugin ignores the header in useHeaders option

The plugin seems to ignore the headers specified in useHeaders option based on case-sensitivity. The problem is that the logic inside the filter method that checks for the header in the request doesn't use toLowerCase on the key, although it does exactly that when reading the actual header value in the next line.

Is this intended or is it just a mistake?

I can't see the purge cache button in production mode

Hi,

I would like to know if it is normal not to have the purge button on my entities when strapi is in production mode? I see in the code that it is logically based on permissions and my permissions are good.

So is it logical that the button does not appear?

Thanks

cache wont automatically purge after content type updated

Hi, many thanks for this package. It might be a bug or just a quick question.

The cache data won't purge unless click Purge Rest Cache button on the list. Should it be done with a built-in config? Do we need an additional config to do that?

Cache type: Memory
Rest cache version: 4.1.0
Strapi version: 4.1.3
Node: v14.18.2

Routes not register on @strapi/[email protected]

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch [email protected] for the project I'm working on.

At the release v4.11.7

Here is the diff that solved my problem:

diff --git a/node_modules/strapi-plugin-rest-cache/server/utils/config/routeExists.js b/node_modules/strapi-plugin-rest-cache/server/utils/config/routeExists.js
index 9f4da8c..8eeb51e 100644
--- a/node_modules/strapi-plugin-rest-cache/server/utils/config/routeExists.js
+++ b/node_modules/strapi-plugin-rest-cache/server/utils/config/routeExists.js
@@ -13,7 +13,7 @@
  */
 function routeExists(strapi, route) {
   // check api routes
-  const match = strapi.server.listRoutes().find(
+  const match = strapi.server.mount().listRoutes().find(
     (routeLayer) =>
       routeLayer.methods.includes(route.method) &&
       routeLayer.path.match(new RegExp(`^${route.path}/?`)) // match with optional leading slash

This issue body was partially generated by patch-package.

Stuck can't start the plugin (see Image)

Hello, this is why every time I run npm run start or develop package it's stuck here (see image) , if i changed it to memory it running well

image

package.json

"strapi-plugin-redis": "^1.0.1",

"strapi-plugin-rest-cache": "^4.2.7",

"strapi-provider-rest-cache-redis": "^4.2.7"

plugin.js

function getPlugins(env) {
  let redisConfig = {
    config: {
      connections: {
        default: {
          connection: {
            host: env("REDIS_CLUSTER_HOST_1"),
            name: "test",
            db: 0,
          },
          settings: {
            debug: Boolean(env("REDIS_CONNECTION_DEBUG")),
          },
        },
      },
    },
  };
  if (env("NODE_ENV") === "production") {
    // Create a Redis cluster client
    let redisClusterUrls = env("REDIS_CLUSTER_HOST_URLS")
      .split(",")
      .map((url) => {
        return {
          host: url,
          port: 6379,
        };
      });
    redisConfig = {
      config: {
        connections: {
          default: {
            connection: {
              nodes: redisClusterUrls,
              name: "test",
              db: 0,
            },
            settings: {
              debug: Boolean(env("REDIS_CONNECTION_DEBUG")),
            },
          },
        },
      },
    };
  }
  return {
    redis: redisConfig,
    "rest-cache": {
      config: {
        provider: {
          name: "redis",
          options: {
            max: 32767,
            connection: "default",
          },
        },
        strategy: {
          keyPrefix: "test",
          // if you are using keyPrefix for your Redis, please add <keysPrefix>
          contentTypes: [
            // list of Content-Types UID to cache
            "api::city.city",
            // "api::community.community",
            "api::competition.competition",
            "api::competition-type.competition-type",
            "api::division.division",
            // "api::match.match",
            "api::match-event.match-event",
            "api::match-lineup.match-lineup",
            "api::match-statistic.match-statistic",
            "api::player.player",
            "api::season.season",
            "api::sponsor.sponsor",
            // "api::stadium.stadium",
            // "api::team.team",
          ],
          debug: Boolean(env("REDIS_STRATEGY_DEBUG")),
          hitpass: false,
          enableXCacheHeaders: true,
        },
      },
    },
    ckeditor: {
      enabled: true,
      config: {
        editor: {
          mediaEmbed: {
            previewsInData: true,
          },
        },
      },
    },
    seo: {
      enabled: true,
    },
    sentry: {
      enabled: true,
      config: {
        // Only set `dsn` property in production
        dsn: env("NODE_ENV") === "production" ? env("SENTRY_DSN") : null,
      },
    },
  };
}
module.exports = ({ env }) => {
  let commonPlugins = getPlugins(env);
  if (env("NODE_ENV") !== "development") {
    commonPlugins = {
      ...commonPlugins,
      upload: {
        config: {
          provider: "aws-s3",
          providerOptions: {
            s3Options: {
              credentials: {
                accessKeyId: env("AWS_ACCESS_KEY_ID"),
                secretAccessKey: env("AWS_ACCESS_SECRET"),
              },
              region: env("AWS_REGION"),
              params: {
                Bucket: env("AWS_BUCKET_NAME"),
              },
            },
          },
          actionOptions: {
            upload: {},
            uploadStream: {},
            delete: {},
          },
        },
      },
    };
  }
  return commonPlugins;
};

Strapi-plugin-rest-cache with memory provider causing missing thumbnail URLs in API responses

I have installed Strapi-plugin-rest-cache with memory provider, which has significantly improved the performance of my website. However, I have noticed that some of the thumbnail URLs are missing in the API responses when the cache is used. I am also using the Strapi-plugin-populate-deep plugin, which may be related to this issue.

I have tried disabling the plugins one at a time to see if the issue persists, but I have not been able to determine the root cause. I believe there may be an issue with how these plugins handle caching or retrieving data.

Can someone please investigate this issue and provide a solution? It would be great to continue using these plugins to improve the performance of my website while ensuring that all necessary data is available in the API responses.

Thank you.

Remove trailing slashes from cache keys

strapi-plugin-rest-cache: v4.2.6

Description
Requested url is used as key for the cache. But the same request with and without trailing slash lead to 2 seperate cache entries. When you update the collection/entry only the url without trailing slashes is purged.

Screenshot
image

Proposed solution
Trailing slashes should be removed from the requested url before use it as key.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.