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

(feature request) Redis Interceptor #18

Open
bashleigh opened this issue Aug 4, 2019 · 4 comments
Open

(feature request) Redis Interceptor #18

bashleigh opened this issue Aug 4, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@bashleigh
Copy link

Hey! Thanks for all the hard work you've made on this package!

I used this package in a code test recently and I built a redis interceptor for caching my routes responses.

It might be handy for others to use this interceptor so I was going to ask, would you like me to add a PR to add the interceptor?

I used it like this

@Controller()
export class TestController {

  constructor (private readonly api: SomeApiClientOrWhatever) {}

  @Get('some/path')
  @UseInterceptor(RedisInterceptor)
  async cacheMe(@Query('page') page: number = 1, @Query('limit') limit: number = 10): Promise<SomeObject[]> {
     return await this.api.get(`get/loads/of/things?page=${page}&per_page=${limit}`);
  }
}

The above would cache the response of cacheMe using the request url + method as the key like so GET.some/path?page=1&limit=10 or GET.some/path. When the cache key exists on a second request, the cache is used rather than calling the method a second time

@bashleigh bashleigh changed the title RedisInterceptor (feature request) Redis Interceptor Aug 4, 2019
@skunight
Copy link
Owner

skunight commented Aug 5, 2019

Oh Welcome,That's great! Thank you!

@skunight skunight added the enhancement New feature or request label Aug 5, 2019
@bashleigh
Copy link
Author

Cool :) I'll make a PR soon!

@bashleigh
Copy link
Author

bashleigh commented Aug 22, 2019

Hey! Sorry for long delay. Long story short I quit a job and got another one in the space of 5 days changed laptops 3 times and I've been waiting to get some free time with the laptop the PR is currently on to push to the repo so I can work on it on another machine.

Also, been struggling with your tests setup. Are you ok if I submit a PR without tests? Or with tests that should pass but I can't run? X'D

@skunight
Copy link
Owner

skunight commented Sep 4, 2019

OK,I will test this PR

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

No branches or pull requests

2 participants