aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--store.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/store.go b/store.go
index 58a8476..b730903 100644
--- a/store.go
+++ b/store.go
@@ -28,6 +28,7 @@ type Store interface {
// Note that New should never return a nil session, even in the case of
// an error if using the Registry infrastructure to cache the session.
New(ctx echo.Context, name string) (*Session, error)
+ Reload(ctx echo.Context, s *Session) error
// Save should persist session to the underlying store implementation.
Save(ctx echo.Context, s *Session) error
@@ -94,6 +95,10 @@ func (s *CookieStore) New(ctx echo.Context, name string) (*Session, error) {
return session, err
}
+func (s *CookieStore) Reload(_ echo.Context, _ *Session) error {
+ return nil
+}
+
// Save adds a single session to the response.
func (s *CookieStore) Save(ctx echo.Context, session *Session) error {
encoded, err := securecookie.EncodeMulti(session.Name(), session.Values,
@@ -188,6 +193,14 @@ func (s *FilesystemStore) New(ctx echo.Context, name string) (*Session, error) {
return session, err
}
+func (s *FilesystemStore) Reload(ctx echo.Context, session *Session) error {
+ err := s.load(ctx, session)
+ if err == nil {
+ session.IsNew = false
+ }
+ return err
+}
+
// Save adds a single session to the response.
func (s *FilesystemStore) Save(ctx echo.Context, session *Session) error {
// Delete if max-age is < 0