Skip to content

Migrate PlatformCache on cache-manager v6 #3070

@Romakita

Description

@Romakita

Here is the translated user story in English, with @tsed/platform-cache and cache-manager@6 references:


🚧 Migrate Ts.ED from node-cache-manager@5 to cache-manager@6

🎯 Goal

Update the caching integration in our Ts.ED application to use the latest stable version of cache-manager (v6), replacing the outdated node-cache-manager@5 currently used via @tsed/platform-cache.


✅ Context

The @tsed/platform-cache module currently relies on node-cache-manager@5. Version 6, released under the renamed cache-manager package, introduces several breaking changes:

  • Fully asynchronous Promise-based API (no more callbacks).
  • Removal of store.create(), replaced by direct constructors.
  • Changes in store modules (memory, redis, etc.).
  • wrap() is still supported, but may require adjustments.

✍️ User Story

As a backend developer,
I want to migrate the caching system using @tsed/platform-cache to cache-manager@6,
so that we can stay up-to-date, avoid deprecated APIs, and ensure long-term maintainability.


🔧 Technical Tasks

  • Remove node-cache-manager@5 and related type definitions.

  • Install cache-manager@6 and update typings if needed.

  • Adapt usage of @tsed/platform-cache to the new API:

    • Update get, set, del, wrap, etc.
    • Review options passed to PlatformCacheModule.
  • Update or replace any custom stores (cache-manager-redis-store, etc.) to be compatible with v6.

  • Refactor any services manually using PlatformCache.

  • Add non-regression tests to validate cache behavior.

  • Document any changes in configuration or behavior.


🧪 Acceptance Criteria

  • The application starts without cache-related errors.
  • All uses of @Cache, @UseCache, or PlatformCache work as expected.
  • All existing cache-related tests pass without regressions.
  • External stores (redis, memory, etc.) work properly with cache-manager@6.
  • A changelog or pull request comment explains the key changes made.

Metadata

Metadata

Assignees

Projects

Status

To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions