接口 BaseCacheableService<ENTITY extends BaseEntity<? extends Serializable>>
-
- 类型参数:
ENTITY- 实体
- 所有超级接口:
BaseService<ENTITY>,com.baomidou.mybatisplus.extension.service.IService<ENTITY>
- 所有已知实现类:
BaseCacheableServiceImpl
public interface BaseCacheableService<ENTITY extends BaseEntity<? extends Serializable>> extends BaseService<ENTITY>
扩展了缓存能力- 作者:
- lym
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 voidclearCache()清理缓存ENTITYgetByCacheKey(Object key, Function<Object,Object> loader)根据 key 查询缓存中存放的id 缓存不存在则根据loader加载并写入数据ENTITYgetByIdFromCache(Serializable id)先查缓存,再查dbList<ENTITY>loadByIds(Collection<? extends Serializable> ids, Function<Collection<? extends Serializable>,Collection<ENTITY>> loader)可能会缓存穿透voidrefreshCache()刷新缓存-
从接口继承的方法 org.shoulder.data.mybatis.template.service.BaseService
checkEntityAs, createPageQueryWrapper, getBaseMapper, getByBizId, handleBeforePageQuery, handlePageQueryResult, list, list, listByBizIds, lockByBizId, lockById, page, query, removeByBizId, removeByBizIds, saveOrUpdate, updateAllById, updateBatchByBizId, updateBatchByBizId, updateByBizId
-
从接口继承的方法 com.baomidou.mybatisplus.extension.service.IService
count, count, getById, getEntityClass, getMap, getObj, getOne, getOne, ktQuery, ktUpdate, lambdaQuery, lambdaUpdate, list, list, listByIds, listByMap, listMaps, listMaps, listObjs, listObjs, listObjs, listObjs, page, page, pageMaps, pageMaps, query, remove, removeById, removeByIds, removeByMap, save, saveBatch, saveBatch, saveOrUpdate, saveOrUpdateBatch, saveOrUpdateBatch, update, update, update, updateBatchById, updateBatchById, updateById
-
-
-
-
方法详细资料
-
getByIdFromCache
ENTITY getByIdFromCache(Serializable id)
先查缓存,再查db- 参数:
id- 主键- 返回:
- 对象
-
getByCacheKey
ENTITY getByCacheKey(Object key, Function<Object,Object> loader)
根据 key 查询缓存中存放的id 缓存不存在则根据loader加载并写入数据- 参数:
key- 缓存keyloader- 数据加载器- 返回:
- 对象
-
loadByIds
List<ENTITY> loadByIds(@NonNull Collection<? extends Serializable> ids, Function<Collection<? extends Serializable>,Collection<ENTITY>> loader)
可能会缓存穿透- 参数:
ids- 主键idloader- 回调- 返回:
- 对象集合
-
refreshCache
void refreshCache()
刷新缓存
-
clearCache
void clearCache()
清理缓存
-
-