use of org.jeecg.common.api.CommonAPI in project kms by mahonelau.
the class DataSourceCachePool method getCacheDynamicDataSourceModel.
/**
* 获取多数据源缓存
*
* @param dbKey
* @return
*/
public static DynamicDataSourceModel getCacheDynamicDataSourceModel(String dbKey) {
String redisCacheKey = CacheConstant.SYS_DYNAMICDB_CACHE + dbKey;
if (getRedisTemplate().hasKey(redisCacheKey)) {
return (DynamicDataSourceModel) getRedisTemplate().opsForValue().get(redisCacheKey);
}
CommonAPI commonAPI = SpringContextUtils.getBean(CommonAPI.class);
DynamicDataSourceModel dbSource = commonAPI.getDynamicDbSourceByCode(dbKey);
if (dbSource != null) {
getRedisTemplate().opsForValue().set(redisCacheKey, dbSource);
}
return dbSource;
}
use of org.jeecg.common.api.CommonAPI in project kykms by mahonelau.
the class DataSourceCachePool method getCacheDynamicDataSourceModel.
/**
* 获取多数据源缓存
*
* @param dbKey
* @return
*/
public static DynamicDataSourceModel getCacheDynamicDataSourceModel(String dbKey) {
String redisCacheKey = CacheConstant.SYS_DYNAMICDB_CACHE + dbKey;
if (getRedisTemplate().hasKey(redisCacheKey)) {
return (DynamicDataSourceModel) getRedisTemplate().opsForValue().get(redisCacheKey);
}
CommonAPI commonAPI = SpringContextUtils.getBean(CommonAPI.class);
DynamicDataSourceModel dbSource = commonAPI.getDynamicDbSourceByCode(dbKey);
if (dbSource != null) {
getRedisTemplate().opsForValue().set(redisCacheKey, dbSource);
}
return dbSource;
}
use of org.jeecg.common.api.CommonAPI in project jeecg-boot by jeecgboot.
the class DataSourceCachePool method getCacheDynamicDataSourceModel.
/**
* 获取多数据源缓存
*
* @param dbKey
* @return
*/
public static DynamicDataSourceModel getCacheDynamicDataSourceModel(String dbKey) {
String redisCacheKey = CacheConstant.SYS_DYNAMICDB_CACHE + dbKey;
if (getRedisTemplate().hasKey(redisCacheKey)) {
return (DynamicDataSourceModel) getRedisTemplate().opsForValue().get(redisCacheKey);
}
CommonAPI commonAPI = SpringContextUtils.getBean(CommonAPI.class);
DynamicDataSourceModel dbSource = commonAPI.getDynamicDbSourceByCode(dbKey);
if (dbSource != null) {
getRedisTemplate().opsForValue().set(redisCacheKey, dbSource);
}
return dbSource;
}
Aggregations