Giter VIP home page Giter VIP logo

Comments (7)

micalevisk avatar micalevisk commented on April 27, 2024 1

I think the the "issue" with having that indirection (NestCache type) is that isn't that clear that the cache manager is from cache-manager lib. But I'm fine with abstracting it away

Also, I'd suggest this one instead:

import { Cache } from '@nestjs/cache-manager';

@Controller()
export class Foo {
  constructor(private cacheManager: Cache) {} // no need to recall the token
yeah, it works

image

from cache-manager.

snys98 avatar snys98 commented on April 27, 2024 1

I think the the "issue" with having that indirection (NestCache type) is that isn't that clear that the cache manager is from cache-manager lib. But I'm fine with abstracting it away

Also, I'd suggest this one instead:

import { Cache } from '@nestjs/cache-manager';

@Controller()
export class Foo {
  constructor(private cacheManager: Cache) {} // no need to recall the token

yeah, it works

yes, I think either way is ok, it's just better to import 1 thing from 1 lib than 2 things from 2 libs

from cache-manager.

jmcdo29 avatar jmcdo29 commented on April 27, 2024 1

Personally, I would rather import the specific token from the Nest wrapper and the actual type from the implementation library. Yes, it's another library to have to worry about, in terms of making sure it comes from the right place, but it also means that Nest can use peerDependencies for the library and allow devs to install whichever version of the library it needs, meaning less maintenance on our side when updates are released.

from cache-manager.

kamilmysliwiec avatar kamilmysliwiec commented on April 27, 2024 1

We could fix this up by adding the extra useExisting provider (= thus not introducing any breaking changes)

from cache-manager.

snys98 avatar snys98 commented on April 27, 2024

Personally, I would rather import the specific token from the Nest wrapper and the actual type from the implementation library. Yes, it's another library to have to worry about, in terms of making sure it comes from the right place, but it also means that Nest can use peerDependencies for the library and allow devs to install whichever version of the library it needs, meaning less maintenance on our side when updates are released.

From my understanding, this library is tightly related to cache-manager and it's appropriate to link cache manager as a peer dependency. It will cause trouble when user installed very old or very new versions, if he didn't know what the version that @nest/cache-manager is actually using.

from cache-manager.

jmcdo29 avatar jmcdo29 commented on April 27, 2024

We already use peerDeps, so as long as cache-manager<=5 is installed, this library will work. If we set to dependencies then npm/yarn/pnpm will auto-install the package

from cache-manager.

kamilmysliwiec avatar kamilmysliwiec commented on April 27, 2024

Let's track this here #256

from cache-manager.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.