mirror of
https://github.com/kataras/iris.git
synced 2026-01-07 12:07:28 +00:00
Fasthttp seems have little bug with headers, so make a VisitAllCookies function and GetFlashes completed- tests added also
This commit is contained in:
@@ -19,15 +19,11 @@ var _ store.IStore = &Store{}
|
||||
|
||||
// GetAll returns all values
|
||||
func (s *Store) GetAll() map[string]interface{} {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return s.values
|
||||
}
|
||||
|
||||
// VisitAll loop each one entry and calls the callback function func(key,value)
|
||||
func (s *Store) VisitAll(cb func(k string, v interface{})) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
for key := range s.values {
|
||||
cb(key, s.values[key])
|
||||
}
|
||||
@@ -36,9 +32,7 @@ func (s *Store) VisitAll(cb func(k string, v interface{})) {
|
||||
// Get returns the value of an entry by its key
|
||||
func (s *Store) Get(key string) interface{} {
|
||||
Provider.Update(s.sid)
|
||||
s.mu.Lock()
|
||||
if value, found := s.values[key]; found {
|
||||
s.mu.Unlock()
|
||||
return value
|
||||
}
|
||||
s.mu.Unlock()
|
||||
|
||||
@@ -81,15 +81,11 @@ func (s *Store) update() {
|
||||
|
||||
// GetAll returns all values
|
||||
func (s *Store) GetAll() map[string]interface{} {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return s.values
|
||||
}
|
||||
|
||||
// VisitAll loop each one entry and calls the callback function func(key,value)
|
||||
func (s *Store) VisitAll(cb func(k string, v interface{})) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
for key := range s.values {
|
||||
cb(key, s.values[key])
|
||||
}
|
||||
@@ -98,12 +94,10 @@ func (s *Store) VisitAll(cb func(k string, v interface{})) {
|
||||
// Get returns the value of an entry by its key
|
||||
func (s *Store) Get(key string) interface{} {
|
||||
Provider.Update(s.sid)
|
||||
s.mu.Lock()
|
||||
if value, found := s.values[key]; found {
|
||||
s.mu.Unlock()
|
||||
return value
|
||||
}
|
||||
s.mu.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user