Class SaTokenRedisJackson

java.lang.Object
cn.sinozg.applet.common.sa.SaTokenRedisJackson
All Implemented Interfaces:
cn.dev33.satoken.dao.SaTokenDao

@Component public class SaTokenRedisJackson extends Object implements cn.dev33.satoken.dao.SaTokenDao
Sa-Token 持久层实现 [Redis存储、Jackson序列化]
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
     
    private final org.slf4j.Logger
     

    Fields inherited from interface cn.dev33.satoken.dao.SaTokenDao

    NEVER_EXPIRE, NOT_VALUE_EXPIRE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    删除Value
    void
    删除Object
    get(String key)
    获取Value,如无返空
    获取Object,如无返空
    long
    获取Object的剩余存活时间 (单位: 秒)
    long
    获取Value的剩余存活时间 (单位: 秒)
    void
     
    cn.dev33.satoken.fun.strategy.SaCreateSessionFunction
    无语 底层 SaTokenDao 煞笔一样的注入方式
    searchData(String prefix, String keyword, int start, int size, boolean sortType)
    搜索数据
    void
    set(String key, String value, long timeout)
    写入Value,并设定存活时间 (单位: 秒)
    void
    setObject(String key, Object object, long timeout)
    写入Object,并设定存活时间 (单位: 秒)
    private void
    setValue(String key, Object value, long timeout)
    写入Value,并设定存活时间 (单位: 秒)
    void
    update(String key, String value)
    修修改指定key-value键值对 (过期时间不变)
    void
    updateObject(String key, Object object)
    更新Object (过期时间不变)
    void
    updateObjectTimeout(String key, long timeout)
    修改Object的剩余存活时间 (单位: 秒)
    void
    updateTimeout(String key, long timeout)
    修改Value的剩余存活时间 (单位: 秒)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface cn.dev33.satoken.dao.SaTokenDao

    deleteSession, destroy, getSession, getSessionTimeout, setSession, updateSession, updateSessionTimeout
  • Field Details

    • isInit

      public boolean isInit
    • log

      private final org.slf4j.Logger log
  • Constructor Details

    • SaTokenRedisJackson

      public SaTokenRedisJackson()
  • Method Details

    • initSession

      @Bean public cn.dev33.satoken.fun.strategy.SaCreateSessionFunction initSession()
      无语 底层 SaTokenDao 煞笔一样的注入方式
      Returns:
      参数
    • init

      public void init()
      Specified by:
      init in interface cn.dev33.satoken.dao.SaTokenDao
    • get

      public String get(String key)
      获取Value,如无返空
      Specified by:
      get in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
      Returns:
      结果
    • set

      public void set(String key, String value, long timeout)
      写入Value,并设定存活时间 (单位: 秒)
      Specified by:
      set in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
      value - value值
      timeout - 过期时间
    • update

      public void update(String key, String value)
      修修改指定key-value键值对 (过期时间不变)
      Specified by:
      update in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
      value - value值
    • delete

      public void delete(String key)
      删除Value
      Specified by:
      delete in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
    • getTimeout

      public long getTimeout(String key)
      获取Value的剩余存活时间 (单位: 秒)
      Specified by:
      getTimeout in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
      Returns:
      过期时间
    • updateTimeout

      public void updateTimeout(String key, long timeout)
      修改Value的剩余存活时间 (单位: 秒)
      Specified by:
      updateTimeout in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
      timeout - 过期时间
    • getObject

      public Object getObject(String key)
      获取Object,如无返空
      Specified by:
      getObject in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
      Returns:
      结果
    • setObject

      public void setObject(String key, Object object, long timeout)
      写入Object,并设定存活时间 (单位: 秒)
      Specified by:
      setObject in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
      object - 对象的值
      timeout - 过期时间
    • updateObject

      public void updateObject(String key, Object object)
      更新Object (过期时间不变)
      Specified by:
      updateObject in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
      object - 对象的值
    • deleteObject

      public void deleteObject(String key)
      删除Object
      Specified by:
      deleteObject in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
    • getObjectTimeout

      public long getObjectTimeout(String key)
      获取Object的剩余存活时间 (单位: 秒)
      Specified by:
      getObjectTimeout in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
      Returns:
      存活时间
    • updateObjectTimeout

      public void updateObjectTimeout(String key, long timeout)
      修改Object的剩余存活时间 (单位: 秒)
      Specified by:
      updateObjectTimeout in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      key - key值
      timeout - 过期时间
    • searchData

      public List<String> searchData(String prefix, String keyword, int start, int size, boolean sortType)
      搜索数据
      Specified by:
      searchData in interface cn.dev33.satoken.dao.SaTokenDao
      Parameters:
      prefix - 前缀
      keyword - 关键词
      start - 开始
      size - 数量
      sortType - 排序类型
      Returns:
      搜索结果
    • setValue

      private void setValue(String key, Object value, long timeout)
      写入Value,并设定存活时间 (单位: 秒)
      Parameters:
      key - key值
      value - value值
      timeout - 过期时间