
com.github.fartherp.shiro.RedisSessionDAO Maven / Gradle / Ivy
/*
* Copyright (c) 2019. CK. All rights reserved.
*/
package com.github.fartherp.shiro;
import io.netty.util.concurrent.FastThreadLocal;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.UnknownSessionException;
import org.apache.shiro.session.mgt.eis.AbstractSessionDAO;
import org.apache.shiro.util.Assert;
import org.apache.shiro.util.StringUtils;
import org.redisson.api.RBucket;
import org.redisson.api.RScoredSortedSet;
import org.redisson.client.codec.Codec;
import org.redisson.client.protocol.ScoredEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
/**
* Created by IntelliJ IDEA.
*
* @author: CK
* @date: 2019/1/1
*/
public class RedisSessionDAO extends AbstractSessionDAO {
private static final Logger LOGGER = LoggerFactory.getLogger(RedisSessionDAO.class);
public static final String DEFAULT_SESSION_KEY_PREFIX = "shiro:session";
private String sessionKeyPrefix = DEFAULT_SESSION_KEY_PREFIX;
private int expire = ExpireType.DEFAULT_EXPIRE.type;
public static final boolean DEFAULT_SESSION_IN_MEMORY_ENABLED = true;
private boolean sessionInMemoryEnabled = DEFAULT_SESSION_IN_MEMORY_ENABLED;
public static final long DEFAULT_SESSION_IN_MEMORY_TIMEOUT = 1000L;
private long sessionInMemoryTimeout = DEFAULT_SESSION_IN_MEMORY_TIMEOUT;
public static final FastThreadLocal
© 2015 - 2025 Weber Informatics LLC | Privacy Policy