chengf
2026-01-30 b8bf2507bc7b23c90bc6dc71ea2460e277d3800a
java110-utils/src/main/java/com/java110/utils/cache/CommonCache.java
old mode 100644 new mode 100755
@@ -1,18 +1,30 @@
package com.java110.utils.cache;
import redis.clients.jedis.Jedis;
import com.java110.utils.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.java110.utils.cache.Jedis;
/**
 * Created by wuxw on 2018/5/5.
 */
public class CommonCache extends BaseCache {
    private final static Logger logger = LoggerFactory.getLogger(MappingCache.class);
    public final static int defaultExpireTime = 5 * 60;
    public final static int RESEND_DEFAULT_EXPIRETIME = 1 * 60;
    public final static int DEFAULT_EXPIRETIME_TWO_MIN = 1 * 60;
    //支付默认回话
    public final static int PAY_DEFAULT_EXPIRE_TIME = 2 * 60 * 60;
    //回话默认回话
    public final static int TOKEN_EXPIRE_TIME = 2 * 60 * 60;
    public static final String RECEIPT_CODE = "_RECEIPT_CODE";// 收据编号
@@ -23,6 +35,8 @@
     */
    public static String getValue(String key) {
        Jedis redis = null;
        long startTime = DateUtil.getCurrentDate().getTime();
        try {
            redis = getJedis();
            return redis.get(key);
@@ -30,6 +44,7 @@
            if (redis != null) {
                redis.close();
            }
            logger.debug( key + " redis 耗时:" + (DateUtil.getCurrentDate().getTime() - startTime));
        }
    }
@@ -41,6 +56,8 @@
    public static String getAndRemoveValue(String key) {
        Jedis redis = null;
        String value = "";
        long startTime = DateUtil.getCurrentDate().getTime();
        try {
            redis = getJedis();
            value = redis.get(key);
@@ -49,6 +66,8 @@
            if (redis != null) {
                redis.close();
            }
            logger.debug( key + "getAndRemoveValue redis 耗时:" + (DateUtil.getCurrentDate().getTime() - startTime));
        }
        return value;
    }