- bug fix.

This commit is contained in:
gazebo
2018-07-19 12:18:36 +08:00
parent bbed659c04
commit 3098740dce
6 changed files with 104 additions and 74 deletions

View File

@@ -1,6 +1,7 @@
package jxutils
import (
"math/rand"
"strings"
"sync"
"time"
@@ -18,6 +19,10 @@ type SyncMapWithTimeout struct {
sync.Map
}
func init() {
rand.Seed(time.Now().Unix())
}
func (m *SyncMapWithTimeout) StoreWithTimeout(key, value interface{}, timeout time.Duration) {
m.Map.Store(key, value)
time.AfterFunc(timeout, func() {