mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 02:47:04 +00:00
Former-commit-id: bcb8905faf20e08be1ef9ec203385a1a7440eebd
This commit is contained in:
@@ -62,7 +62,11 @@ func (s *mem) Set(sid string, lifetime LifeTime, key string, value interface{},
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *mem) Get(sid string, key string) interface{} {
|
func (s *mem) Get(sid string, key string) interface{} {
|
||||||
return s.values[sid].Get(key)
|
s.mu.RLock()
|
||||||
|
v := s.values[sid].Get(key)
|
||||||
|
s.mu.RUnlock()
|
||||||
|
|
||||||
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *mem) Visit(sid string, cb func(key string, value interface{})) {
|
func (s *mem) Visit(sid string, cb func(key string, value interface{})) {
|
||||||
@@ -70,7 +74,11 @@ func (s *mem) Visit(sid string, cb func(key string, value interface{})) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *mem) Len(sid string) int {
|
func (s *mem) Len(sid string) int {
|
||||||
return s.values[sid].Len()
|
s.mu.RLock()
|
||||||
|
n := s.values[sid].Len()
|
||||||
|
s.mu.RUnlock()
|
||||||
|
|
||||||
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *mem) Delete(sid string, key string) (deleted bool) {
|
func (s *mem) Delete(sid string, key string) (deleted bool) {
|
||||||
@@ -81,9 +89,9 @@ func (s *mem) Delete(sid string, key string) (deleted bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *mem) Clear(sid string) {
|
func (s *mem) Clear(sid string) {
|
||||||
s.mu.RLock()
|
s.mu.Lock()
|
||||||
s.values[sid].Reset()
|
s.values[sid].Reset()
|
||||||
s.mu.RUnlock()
|
s.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *mem) Release(sid string) {
|
func (s *mem) Release(sid string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user