|
@@ -38,7 +38,14 @@ public class RedisCache
|
|
|
*/
|
|
|
public <T> void setCacheObject(final String key, final T value)
|
|
|
{
|
|
|
- redisTemplate.opsForValue().set(key, value);
|
|
|
+ String unionKey = key;
|
|
|
+ if(Validator.isNotEmpty(ServletUtils.getRequest())){
|
|
|
+ String tenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ if(Validator.isNotEmpty(tenantId)){
|
|
|
+ unionKey = tenantId + key;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ redisTemplate.opsForValue().set(unionKey, value);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -113,11 +120,14 @@ public class RedisCache
|
|
|
*/
|
|
|
public boolean deleteObject(final String key)
|
|
|
{
|
|
|
- String tenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
String unionKey = key;
|
|
|
- if(Validator.isNotEmpty(tenantId)){
|
|
|
- unionKey = tenantId + key;
|
|
|
+ if(Validator.isNotEmpty(ServletUtils.getRequest())){
|
|
|
+ String tenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ if(Validator.isNotEmpty(tenantId)){
|
|
|
+ unionKey = tenantId + key;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
return redisTemplate.delete(unionKey);
|
|
|
}
|
|
|
|