SaStorage 规范数据读写接口

This commit is contained in:
click33
2022-08-19 07:55:35 +08:00
parent e846e80dce
commit 4fac700ff0
7 changed files with 39 additions and 35 deletions

View File

@@ -37,12 +37,13 @@ public class SaStorageForDubbo implements SaStorage {
* 在 [Request作用域] 里写入一个值
*/
@Override
public void set(String key, Object value) {
public SaStorageForDubbo set(String key, Object value) {
rpcContext.setObjectAttachment(key, value);
// 如果是token写入则回传到Consumer端
if(key.equals(SaTokenConsts.JUST_CREATED_NOT_PREFIX)) {
RpcContext.getServerContext().setAttachment(key, value);
}
return this;
}
/**
@@ -57,8 +58,9 @@ public class SaStorageForDubbo implements SaStorage {
* 在 [Request作用域] 里删除一个值
*/
@Override
public void delete(String key) {
public SaStorageForDubbo delete(String key) {
rpcContext.removeAttachment(key);
return this;
}
}