jetCahce核心流程
2025-06-20 17:17:12 0 举报
jetCahce核心流程
作者其他创作
大纲/内容
CacheContext#createCacheByCachedConfig
SimpleCacheManager#create
创建一个CacheLoader
AbstractCache#do_REMOVE实现类实现具体逻辑
CacheBuilder每个 Cache 都是通过这个类创建的
@CacheUpdate
JetCacheAutoConfiguration
ExpressionUtil#evalValue
注入AbstractCacheAutoInit 的实现类
如果配置文件指定了当前的类型,就会通过 Spring 实例化 Bean
CachePointcut包扫描路径下的所有对象
AbstractCache#do_PUT实现类实现具体逻辑
CacheHandler#doUpdate
AbstractCache#needUpdate是否需要保存
CacheContext#createOrGetCache创建或获取缓存
AbstractCache#computeIfAbsentImpl核心缓存逻辑
CacheManager#getOrCreateCache
afterPropertiesSet在 Spring 注入 Bean 时会调用
CacheHandler#invoke
每个配置类都有一个JetCacheCondition的实现类
如果是RefreshCache
CacheConfigUtil#parse解析注解
@CacheInvalidate
JetCacheProxyConfiguration
ExpressionUtil#evalKey生成 key
使用 SpringEL 表达式ExpressionEvaluator
CacheHandler#invokeWithInvalidateOrUpdate
ExpressionUtil#evalPostCondition通过 SpringEL 表达式判断
JetCacheInterceptor#invoke所有被注解的方法都会在处理
CacheAdvisor创建一个 Aop 对象,切所有带注解的方法
未指定 KeyScript
condition 判断通过
如果没有获取到缓存
CachePointcut#matchesImpl
ExpressionUtil#evalCondition
AbstractCache#do_GET实现类实现不同逻辑
保存缓存
RefreshCache#addOrUpdateRefreshTask添加刷新任务
AbstractCacheBuilder#buildCache实现类需要实现创建缓存的逻辑
ExpressionUtil#evalKey解析 Key
CacheContext#__createOrGetCache
包了一层,记录缓存执行时间。并发送CacheLoadEvent事件
指定 KeyScript
指定 condition
initCache实现类都会实现的初始化方法
CacheHandler#invokeWithCached
_没有参数就是$JETCACHE_NULL_KEY$_有参数就是方法参数
@EnableMethodCache获取注解的缓存配置信息(扫描包路径)
AbstractCache#GET
ExpressionUtil#evalCondition判断是否需要执行
ExpressionUtil#evalCondition判断是否走缓存逻辑
JetCacheInterceptor
AbstractCache#do_PUT实现类实现不同逻辑
AbstractCache#PUT
RefreshCache.RefreshTask#run根据参数刷新缓存
@Import
@Cache@RefreshCache
.CacheHandler#doInvalidate
ExpressionUtil#evalKey
CacheUtil#createProxyLoader
Cache#PUT
Cache#REMOVE
0 条评论
下一页