-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Hello!
When using @fortedigital/nextjs-cache-handler/redis-strings, Redis not only stores the actual cache entries but also creates sharedTags and sharedTagsTtl keys.
Both sharedTags and sharedTagsTtl are created with TTL = -1, meaning they never expire.
Entries inside these structures are never cleaned up and keep accumulating over time.
This leads to unbounded growth in Redis usage, which can reach gigabytes and significantly impact performance and storage costs.
The cache lifetime is 300 seconds. And redis clears the keys when ttl ends.
Steps to reproduce:
Configure caching with @fortedigital/nextjs-cache-handler/redis-strings.
Request multiple pages so they are cached.
Inspect Redis:
sharedTags and sharedTagsTtl keys exist,
Both have TTL = -1,
Their size keeps growing with more cached entries.
Expected behavior:
sharedTags and sharedTagsTtl should either:
Expire together with the cache entries they reference, or
Be periodically cleaned up to prevent unbounded growth.
Actual behavior:
sharedTags and sharedTagsTtl never expire.
They continuously accumulate data and can consume large amounts of memory.
And the records inside these structures (sharedTags and sharedTagsTtl) are not cleared
Environment:
Package: @fortedigital/nextjs-cache-handler: 2.0.3
Redis version: 5.8.2
Node.js version: 22.19.0
Next.js version: 15.3.4