All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gitee.fufu669.utils.CacheRedisKeyUtil Maven / Gradle / Ivy

There is a newer version: 6.666.66021
Show newest version
package com.gitee.fufu669.utils;

import com.gitee.fufu669.common.CacheKeyCommon;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** @author wangfupeng */
public class CacheRedisKeyUtil {

	public static final Logger logger = LoggerFactory.getLogger(CacheRedisKeyUtil.class);

	public static String getLockWithRedisAopLockKeyRedisKey(String key) {
		return "lock:"+key;
	}

	public static String getPasswordRedisKey(String key) {
		if(key==null) {
			return CacheKeyCommon.PASSWORD + "null";
		}
		if (key.length() > CacheKeyCommon.REDIS_KEY_EXCEED_MAX_VALUE) {
			return CacheKeyCommon.PASSWORD + "" + key.substring(0, CacheKeyCommon.REDIS_KEY_EXCEED_MAX_VALUE);
		} else {
			return CacheKeyCommon.PASSWORD + "" + key;
		}
	}

    public static String getTokenRedisKey(String key) {
        if (key == null) {
            return CacheKeyCommon.TOKEN + "null";
        }
        if (key.length() > CacheKeyCommon.REDIS_KEY_EXCEED_MAX_VALUE) {
            return CacheKeyCommon.TOKEN + "" + key.substring(0, CacheKeyCommon.REDIS_KEY_EXCEED_MAX_VALUE);
        } else {
            return CacheKeyCommon.TOKEN + "" + key;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy