Update a single object with @ CachePut, query all objects with @ Cacheable, so how do you write the annotation?

@ CachePut
public Result updateUser (User user) {

}

@ Cacheable
public Result getUserList () {

}
query the (getUserList) of all users and store it in the cache. After modifying the individual user information (updateUser), how to update the cache of all users?


Spring Cache storage is a way of key-value pairs, and your requirements cannot be realized by annotations. It is recommended to use CacheManager to deal with getUserList

.
Menu