You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using an external cache store (e.g., Redis), I want to directly access the store to purge the cache key instead of revalidating.
In this case, I want to customize the cache key encoding algorithm so that developers can manage the key themselves (because there is a possibility that the existing cache key encoding algorithm might change).
Non-Goals
None
Background
Please consider the following two situations.
Using the CacheHandler option to utilize Redis as a cache store.
In a CMS, the router handler is used to undergo a revalidate process.
When updating data in the CMS, a revalidate process is initiated using the router handler. In this case, a user can forcibly access the router handler to revalidate, and I want to prevent this.
However, if Redis is used, this process could be omitted. After updating data in the CMS, accessing Redis to delete the specific cache key would suffice. Currently, the same key can be obtained using the implemented fetchCacheKey method, but it would be inconvenient to continuously track this method if the encoding algorithm changes.
Therefore, I'm considering allowing developers to customize the algorithm inside fetchCacheKey. I want to manage the cache key using the same encoding algorithm in both the Next.js project and the CMS.
Is it a feasible method?
Proposal
If fetchCacheKey is not customized, the existing fetchCacheKey should be used.
If fetchCacheKey is customized, it would be beneficial to allow the fetchCacheKey logic within Next.js to utilize the customized fetchCacheKey.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
None
Background
Please consider the following two situations.
When updating data in the CMS, a revalidate process is initiated using the router handler. In this case, a user can forcibly access the router handler to revalidate, and I want to prevent this.
However, if Redis is used, this process could be omitted. After updating data in the CMS, accessing Redis to delete the specific cache key would suffice. Currently, the same key can be obtained using the implemented fetchCacheKey method, but it would be inconvenient to continuously track this method if the encoding algorithm changes.
Therefore, I'm considering allowing developers to customize the algorithm inside fetchCacheKey. I want to manage the cache key using the same encoding algorithm in both the Next.js project and the CMS.
Is it a feasible method?
Proposal
ref) https://nextjs.org/docs/app/building-your-application/deploying#configuring-caching
Beta Was this translation helpful? Give feedback.
All reactions