Skip to content

Commit

Permalink
refactor(middleware/session): Update session middleware for v3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sixcolors committed Sep 19, 2024
1 parent ecac9ce commit e272082
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions docs/whats_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,17 @@ Added support for specifying Key length when using `encryptcookie.GenerateKey(le

### Session

:::caution
DRAFT section
:::
The Session middleware has undergone key changes in v3 to improve functionality and flexibility. While v2 methods remain available for backward compatibility, we now recommend using the new middleware handler for session management.

Check failure on line 317 in docs/whats_new.md

View workflow job for this annotation

GitHub Actions / markdownlint

Trailing spaces

docs/whats_new.md:317:233 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md009.md

#### Key Updates:

Check failure on line 319 in docs/whats_new.md

View workflow job for this annotation

GitHub Actions / markdownlint

Trailing punctuation in heading

docs/whats_new.md:319:17 MD026/no-trailing-punctuation Trailing punctuation in heading [Punctuation: ':'] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md026.md

- **New Middleware Handler**: The `New` function now returns a middleware handler instead of a `*Store`. To access the session store, use the `Store` method on the middleware, or opt for `NewWithStore` for custom store integration.

- **Manual Session Release**: Session instances are no longer automatically released after being saved. To ensure proper lifecycle management, you must manually call `sess.Release()`.

- **Idle Timeout**: The `Expiration` field has been replaced with `IdleTimeout`, which strictly handles session inactivity. If you require a maximum session duration, you'll need to implement it within your own session data.

For more details on these changes and migration instructions, check the [Session Middleware Migration Guide](./middleware/session.md#migration-guide).

### Filesystem

Expand Down

0 comments on commit e272082

Please sign in to comment.