1
0
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:
Makis Maropoulos
2016-07-07 00:25:50 +02:00
parent 2cc75817b7
commit 01914b6c37
9 changed files with 502 additions and 260 deletions

View File

@@ -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()

View File

@@ -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
}