Package cn.dev33.satoken.application
Interface SaSetValueInterface
- All Superinterfaces:
SaGetValueInterface
- All Known Subinterfaces:
SaStorage
- All Known Implementing Classes:
SaApplication,SaSession,SaStorageForMock
对写值的一组方法封装
封装 SaStorage、SaSession、SaApplication 等存取值的一些固定方法,减少重复编码
- Since:
- 1.31.0
- Author:
- click33
-
Method Summary
Modifier and TypeMethodDescription删值default <T> Tget(String key, SaRetGenericFunction<T> fun) 取值 (如果值为 null,则执行 fun 函数获取值,并把函数返回值写入缓存)写值default SaSetValueInterface写值 (只有在此 key 原本无值的情况下才会写入)Methods inherited from interface cn.dev33.satoken.application.SaGetValueInterface
get, get, getDouble, getFloat, getInt, getLong, getModel, getModel, getString, getValueByDefaultValue, has, valueIsNull
-
Method Details
-
set
写值- Parameters:
key- 名称value- 值- Returns:
- 对象自身
-
delete
删值- Parameters:
key- 要删除的key- Returns:
- 对象自身
-
get
取值 (如果值为 null,则执行 fun 函数获取值,并把函数返回值写入缓存)- Type Parameters:
T- 返回值的类型- Parameters:
key- keyfun- 值为null时执行的函数- Returns:
- 值
-
setByNull
写值 (只有在此 key 原本无值的情况下才会写入)- Parameters:
key- 名称value- 值- Returns:
- 对象自身
-