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

[Feat] Add @tsed/ioredis package #2060

Closed
2 tasks
Romakita opened this issue Aug 27, 2022 · 5 comments · Fixed by #2063
Closed
2 tasks

[Feat] Add @tsed/ioredis package #2060

Romakita opened this issue Aug 27, 2022 · 5 comments · Fixed by #2063

Comments

@Romakita
Copy link
Collaborator

Romakita commented Aug 27, 2022

Information

Is your feature request related to a problem? Please describe.

As developer I want a module to create a redis connection and share this connection with @tsed/platorm-cache and @tsed/adapter-redis packages.

The module provide also a way to create unit test with with ioredis-mock module.

Describe the solution you'd like

// RedisConnection.ts
import {registerConnectionProvider} "@tsed/ioredis";
import {Redis} "ioredis";

export const REDIS_CONNECTION = Symbol.for("REDIS_CONNECTION");
export type REDIS_CONNECTION = Redis;

registerConnectionProvider({provide: REDIS_CONNECTION, name: "default"});

// in Server.ts
import {Configuration} from "@tsed/di";

import {Redis} "ioredis";
import "@tsed/platform-cache";

@Configuration({
   ioredis: [
      {
         name: "default",
         // ... redis options
      }
  ],
  cache: {
    ttl: 300 
    // store are automatically configured by @tsed/iodredis
  }
})

// MyService.ts
import {Injectable, Inject} from "@tsed/di";
import {REDIS_CONNECTION} from "./RedisConnection";

@Injectable()
class MyService {
   @Inject(REDIS_CONNECTION)
   connection: REDIS_CONNECTION;
}

Acceptance criteria

  • The connection is created and shareable with @tsed/platform-cache
  • The connection support classic connection and Cluster
@Romakita Romakita self-assigned this Aug 27, 2022
Romakita added a commit that referenced this issue Aug 28, 2022
Romakita added a commit that referenced this issue Aug 28, 2022
Romakita added a commit that referenced this issue Aug 28, 2022
@Romakita Romakita linked a pull request Aug 28, 2022 that will close this issue
4 tasks
Romakita added a commit that referenced this issue Aug 28, 2022
Romakita added a commit that referenced this issue Aug 28, 2022
Romakita added a commit that referenced this issue Aug 29, 2022
Romakita added a commit that referenced this issue Aug 29, 2022
@github-actions
Copy link

🎉 Are you happy?

If you appreciated the support, know that it is free and is carried out on personal time ;)

A support, even a little bit makes a difference for me and continues to bring you answers!

github opencollective

@Romakita
Copy link
Collaborator Author

🎉 This issue has been resolved in version 6.129.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Romakita added a commit that referenced this issue Aug 29, 2022
@Romakita
Copy link
Collaborator Author

🎉 This issue has been resolved in version 7.0.0-rc.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Romakita
Copy link
Collaborator Author

🎉 This issue has been resolved in version 7.0.0-rc.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Romakita Romakita moved this to Done in Global Board Oct 3, 2022
@Romakita
Copy link
Collaborator Author

Romakita commented Oct 8, 2022

🎉 This issue has been resolved in version 7.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

1 participant