me.zhyd.braum.spring.boot.utils.GlobalBraumUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of braum-spring-boot-starter Show documentation
Show all versions of braum-spring-boot-starter Show documentation
Spring Boot Support for Braum
The newest version!
package me.zhyd.braum.spring.boot.utils;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public enum GlobalBraumUtil {
INSTANCE;
private static final String PREFIX = "braum:black:";
private static final String cacheKeyPrefix = "braum_";
private static final String blacklistKeyPrefix = "braum_blacklist_";
/**
* @return blog:black:braum_
*/
public String getLockKey(String ip) {
return PREFIX + formatKey(cacheKeyPrefix + ip);
}
/**
* @return blog:black:braum_blacklist_
*/
public String getBlacklistKey(String ip) {
return PREFIX + formatKey(blacklistKeyPrefix + ip);
}
public String formatKey(String key) {
if (null == key || key.isEmpty()) {
return null;
}
return key.replaceAll("[.:]", "_");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy