RedissonCach的源码流程

上: https://blog.csdn.net/Michelle_Zhong/article/details/126384566

中: https://blog.csdn.net/michelle_zhong/category_11874153.html

下: https://blog.csdn.net/Michelle_Zhong/article/details/126391915?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522169840913516800225599583%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=169840913516800225599583&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-2-126391915-null-null.142v96pc_search_result_base5&utm_term=redisson__timeout&spm=1018.2226.3001.4187

@Cacheable(cacheNames = CacheNames.SYS_USER_ID_NO, key = "#idno")

RedissonCach的源码流程_第1张图片
RedissonCach的源码流程_第2张图片

Java 使用 @Cacheable 查询DB返回值为null时,不缓存

我这里的使用场景是正常获取到对象就redis缓存
如果查询DB为null,l则不往redis里存

方法:

@Cacheable(unless = "#result == null") # unless 后面就写你不缓存的条件,我这里就是最简单的null

你可能感兴趣的:(java,开发语言)