Method level @Cache annotations for Service
See original GitHub issueI’m submitting a…
[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
Only cacheing implemented for controllers. missing auto cache invalidation
Expected behavior
proposed example:
@CacheConfig("pets")
class PetService {
@Cacheable
findById(id: Long): Pet {
}
@CachePut
save(pet: Pet) {
}
@CacheInvalidate
delete(pet: Pet) {
}
}
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
we like to control caching and cache invalidation for CRUD Services automatically, key can be derived from args e.g., https://github.com/havsar/node-ts-cache/blob/master/src/CacheDecorator.ts
Environment
Nest version: X.Y.Z
For Tooling issues:
- Node version: XX
- Platform:
Others:
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
A Guide To Caching in Spring - Baeldung
To enable caching, Spring makes good use of annotations, much like enabling any other configuration level feature in the framework.
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 >29. Cache Abstraction - Spring
For caching declaration, the abstraction provides two Java annotations: @Cacheable and @CacheEvict which allow methods to trigger cache population or cache ...
Read more >Spring Boot Caching 101 - Auth0
This method-level annotation lets Spring Boot know that the return value of the annotated method can be cached. Each time a method marked ......
Read more >Implementing a Cache with Spring Boot - Reflectoring
The method get() is annotated with @Cachable . This annotation starts the powerful Spring cache support. The data in the cache is stored...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here is a simple
@Cache
decorator withlru-cache
:usage:
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.