question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature, Question] Method level @Cache annotation

See original GitHub issue

Want to implement one, but the only way to access Request, Response - via middlewares, which are outside of the controller. Is it possible using the current (3.x) version of Nest?

import { Controller, Get, Post, HttpStatus } from '@nestjs/common';

@Controller()
export class UsersController {
    @Cache({period: '1m', key: (req, res) => req.originalUrl})
    @Get('users')
    getAllUsers() {}
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
chriszrccommented, Sep 22, 2017

Could we use something like this out of the box at least on the service methods?

https://www.npmjs.com/package/node-ts-cache

(Also, is there a better one out there already, or is this the place to start?)

0reactions
lock[bot]commented, Sep 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Method level @Cache annotations for Service #1032 - GitHub
I'm submitting a... [ ] Regression [ ] Bug report [x] Feature request [ ] Documentation issue or request [ ] Support request...
Read more >
Spring Boot Caching - Javatpoint
It is a method level annotation. It is used when we want to remove stale or unused data from the cache. It requires...
Read more >
Spring cache annotations: some tips & tricks | iO
In this post I'll assume you know how the caching annotations work and provide you with some tips & tricks for using them....
Read more >
Spring Caching | Java Development Journal
The @CachePut annotation is useful if we want to update cache without affecting method execution. The @CacheEvict annotation can create an issue ...
Read more >
Cache Abstraction: JCache (JSR-107) Annotations Support
@CacheResult brings the concept of exception cache: whenever a method execution failed, it is possible to cache the exception that was raised to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found