love.keeping.starter.web.components.cache.CacheVariables Maven / Gradle / Ivy
The newest version!
package love.keeping.starter.web.components.cache;
import love.keeping.starter.common.constants.StringPool;
import love.keeping.starter.web.common.tenant.TenantContextHolder;
import love.keeping.starter.web.utils.TenantUtil;
/**
* 缓存变量
*/
public class CacheVariables {
/**
* 租户ID
*
* @return
*/
public static String tenantId() {
if (!TenantUtil.enableTenant()) {
return StringPool.EMPTY_STR;
}
Integer tenantId = TenantContextHolder.getTenantId();
if (tenantId == null) {
return StringPool.EMPTY_STR;
}
return String.valueOf(tenantId) + "::";
}
}