use of com.dimple.framework.config.redis.CacheExpire in project DimpleBlog by martin-chips.
the class DashboardServiceImpl method getLineChartData.
@Override
@Cacheable(value = "DashBoard", key = "'LineChartData'+ #type")
@CacheExpire(expire = 3, type = TimeType.HOURS)
public LineChartData<Long> getLineChartData(String type) {
LineChartData lineChartData;
switch(type) {
case LineChartData.BLOG_LINE:
lineChartData = getBlogLineChartData();
break;
case LineChartData.VISITOR_LINE:
lineChartData = getVisitorLineChartData();
break;
default:
lineChartData = new LineChartData();
}
log.info("get line chart data \n{}", lineChartData);
return lineChartData;
}
use of com.dimple.framework.config.redis.CacheExpire in project DimpleBlog by martin-chips.
the class ConfigServiceImpl method selectConfigByConfigKey.
@Override
@Cacheable(value = CacheConstants.CACHE_NAME_BACKEND_CONFIG, key = "#key")
@CacheExpire(expire = 5, type = TimeType.HOURS)
public <T> T selectConfigByConfigKey(String key, Class<T> tClass) {
Config config = new Config();
config.setConfigKey(key);
Config retConfig = configMapper.selectConfig(config);
if (retConfig == null) {
throw new CustomException("Can not get config by key " + key);
}
return JSON.parseObject(retConfig.getConfigValue(), tClass);
}
use of com.dimple.framework.config.redis.CacheExpire in project DimpleBlog by martin-chips.
the class FrontServiceImpl method selectBlogDetailById.
@Override
@Cacheable(value = CacheConstants.CACHE_NAME_FRONT_BLOG_ITEM, key = "'BlogId:' +#id")
@CacheExpire(expire = 1, type = TimeType.MINUTES)
public Blog selectBlogDetailById(Long id) {
Blog blog = frontMapper.selectBlogDetailById(id);
// get all comment
blog.setCommentList(selectCommentListByPageId(id));
return blog;
}
Aggregations