|
|
@@ -15,7 +15,7 @@ type TokenStore interface {
|
|
|
Get(string) *entitys.Token
|
|
|
Set(string, *entitys.Token)
|
|
|
Remove(key string)
|
|
|
- Refresh(key string)
|
|
|
+ Refresh(key string) *entitys.Token
|
|
|
}
|
|
|
|
|
|
type MemoryStore struct {
|
|
|
@@ -65,14 +65,14 @@ func (t *MemoryStore) Remove(key string) {
|
|
|
delete(t.tokens, key)
|
|
|
}
|
|
|
|
|
|
-func (t *MemoryStore) Refresh(key string) {
|
|
|
+func (t *MemoryStore) Refresh(key string) *entitys.Token {
|
|
|
t.lock.Lock()
|
|
|
defer t.lock.Unlock()
|
|
|
-
|
|
|
val, ok := t.tokens[key]
|
|
|
if ok {
|
|
|
val.TimeStamp = uint64(time.Now().UnixNano())
|
|
|
}
|
|
|
+ return val
|
|
|
}
|
|
|
|
|
|
func (t *MemoryStore) startTokenCheckProcess() {
|