# Disable cache resurrection for plugins

**URL:** <https://discuss.konghq.com/t/disable-cache-resurrection-for-plugins/8684>\
**Category:** Questions\
**Created:** [July 11, 2021, 8:22am UTC](https://discuss.konghq.com/t/disable-cache-resurrection-for-plugins/8684 "2021-07-11T08:22:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zm08](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/zm08/32/2868_2.png) [@zm08](https://discuss.konghq.com/u/zm08)\
**Post date:** [July 11, 2021, 8:22am UTC](https://discuss.konghq.com/t/disable-cache-resurrection-for-plugins/8684/1 "2021-07-11T08:22:06Z")

</div>

Hi

I have a setup where I want the user to authenticate for an API. I wrote a plugin for that and it works as expected except for the following scenario:

If the user is authenticated and is cached after the cache expires and the internet is disconnected, a request on the protected route logs the following

```auto
[warn] 30#0: *301 [lua] mlcache.lua:763: get(): callback returned an error (failed to call introspection endpoint: [cosocket] DNS resolution failed: dns server error: 3 name error. Tried: ["(short)<API_ENDPOINT>:(na) - cache-miss","<API_ENDPOINT>:33 - cache-miss/scheduled/querying/dns server error: 3 name error","API_ENDPOINT>:1 - cache-miss/scheduled/querying/dns server error: 3 name error","API_ENDPOINT>:5 - cache-miss/scheduled/querying/dns server error: 3 name error"]) but stale value found in shm will be resurrected for 30s (resurrect_ttl), client: 192.168.128.1, server: kong, request: "POST / HTTP/1.1", host: "localhost:3000"

```

Since the stale value is found in shm and is resurrected, the API call goes through even when it should fail.

Is there a way to:

1. Disable the cache resurrection OR
2. Remove the stale values from the cache?

---

<div class="post-metadata">

**Author:** ![thibaultcha](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/thibaultcha/32/340_2.png) [@thibaultcha](https://discuss.konghq.com/u/thibaultcha)\
**Post date:** [July 12, 2021, 7:34pm UTC](https://discuss.konghq.com/t/disable-cache-resurrection-for-plugins/8684/2 "2021-07-12T19:34:12Z")

</div>

Hello,

If you are using the `kong.cache` instance (which is reserved for Kong core’s cache), then that instance has `resurrect_ttl` specified (from `kong.conf`), see [mlcache’s documentation](https://github.com/thibaultcha/lua-resty-mlcache#get) for more details. If this option is specified at the instance level, it can be overridden in `get()` but I don’t believe that it can be disabled entirely for a particular `get()` call; something to double check in the mlcache code.

It appears that you have two options:

1. Use your own mlcache instance which you can configure for your own use-case.
2. Contribute a tiny feature to mlcache so that calls to `get()` could skip resurrection somehow even if it is enabled in the instance (maybe specifying `resurrect_ttl = 0` in `get()`? Something to be debated elsewhere).

Hope that helps.
