feat: enhance session manager to support custom drivers#1005
feat: enhance session manager to support custom drivers#1005hwbrzzl merged 5 commits intogoravel:masterfrom
Conversation
Refactor session manager architecture to allow for custom driver integration. Update file driver implementation to be compatible with these changes, making the session system more extensible and flexible.
|
It looks like no changes are needed for the |
It seems only structure is optimized, logic is not changed. |
session/driver/file.go
Outdated
|
|
||
| filePath := f.getFilePath(id) | ||
|
|
||
| // 1. Check existence first (optimization) |
There was a problem hiding this comment.
Let's consider if comments are really necessary
Revert back the file driver to the original content Make sure that the gc use UTC when checking ModTime Follow goravel code style
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1005 +/- ##
==========================================
- Coverage 70.23% 70.19% -0.04%
==========================================
Files 169 169
Lines 11456 11498 +42
==========================================
+ Hits 8046 8071 +25
- Misses 3059 3073 +14
- Partials 351 354 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi Team, I reverted the file driver back to the original content as you suggested, I only updated the GC to convert info.ModTime to UTC before checking Thanks |
|
Hi Team, Just for information I just pushed the redis driver for Session module : https://github.com/merouanekhalili/session-redis-driver Thanks |
session/manager.go
Outdated
| err := m.Extend(name, factoryWrapper) | ||
| if err != nil { | ||
| color.Errorf("Failed to register driver '%s': %s\n", name, err) | ||
| } |
There was a problem hiding this comment.
| err := m.Extend(name, factoryWrapper) | |
| if err != nil { | |
| color.Errorf("Failed to register driver '%s': %s\n", name, err) | |
| } | |
| return m.Extend(name, factoryWrapper) |
Amazing. Could you merge it into https://github.com/goravel/redis? We can set it as an official implementation. |
hwbrzzl
left a comment
There was a problem hiding this comment.
Great, almost complete. 👍
Add file drive case to registerConfiguredDrivers func
Refactor session manager architecture to allow for custom driver integration. Update file driver implementation to be compatible with these changes, making the session system more extensible and flexible.
📑 Description
Overview
This pull request introduces a significant refactor of the Session Manager to allow the use of custom session drivers, including Redis. The initial goal was to implement a Redis session driver directly; however, I discovered that the current implementation of the Session Manager did not support such integration. To overcome this limitation, I refactored both the Session Manager and its associated file driver, paving the way for adding custom session drivers.
Updated Session Configuration: