Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value being set inside "v" field on new version v2 #669

Closed
RabahZeineddine opened this issue Apr 28, 2024 · 2 comments
Closed

Value being set inside "v" field on new version v2 #669

RabahZeineddine opened this issue Apr 28, 2024 · 2 comments
Labels

Comments

@RabahZeineddine
Copy link

Describe the bug

After updating the lib to the new v2 version every value is being set inside a v field

How To Reproduce (best to provide workable code or tests!)
Check my implementation

import { Cache, caching } from 'cache-manager';
import { RedisStore, redisStore } from 'cache-manager-ioredis-yet';

export class MyClass {

  store: RedisStore;
  private cacheManager: Cache<RedisStore>;
  
    private async getCacheManager() {
    if (this.cacheManager) return;

    this.store = await redisStore({
      host: this.options.redis.host,
      db: this.options.redis.db,
      ttl: this.options.redis.defaultTTL,
    });
    this.cacheManager = await caching(this.store);
  }

  async cacheGet<T>(key: string): Promise<T | undefined> {
    await this.getCacheManager();
    return this.cacheManager.get<T>(key);
  }

  async cacheSet(key: string, value: unknown, ttl?: number): Promise<void> {
    if (!ttl) ttl = this.options.redis.defaultTTL ?? 0;
    await this.getCacheManager();
    return this.cacheManager.set(key, value, ttl);
  }
}

After using the cacheSet and cacheGet method, I'm getting this results.
Captura de Tela 2024-04-28 às 16 13 36

I'm setting a normal number (not an object)

@jaredwray
Copy link
Owner

@RabahZeineddine - thanks for creating this bug and we will be looking into this soon.

@jaredwray
Copy link
Owner

@RabahZeineddine - this will be deployed in a couple weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants