mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
Update module code.forgejo.org/go-chi/session to v1.0.3 (forgejo) (#11324)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11324 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
commit
dc65408618
7 changed files with 28 additions and 21 deletions
|
|
@ -84,6 +84,11 @@ func (s *DBStore) Flush() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// True if no keys have been set
|
||||
func (s *DBStore) Empty() bool {
|
||||
return len(s.data) == 0
|
||||
}
|
||||
|
||||
// DBProvider represents a DB session provider implementation.
|
||||
type DBProvider struct {
|
||||
maxLifetime int64
|
||||
|
|
|
|||
|
|
@ -103,6 +103,11 @@ func (s *RedisStore) Flush() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// True if no keys have been set
|
||||
func (s *RedisStore) Empty() bool {
|
||||
return len(s.data) == 0
|
||||
}
|
||||
|
||||
// RedisProvider represents a redis session provider implementation.
|
||||
type RedisProvider struct {
|
||||
c nosql.RedisClient
|
||||
|
|
|
|||
|
|
@ -76,7 +76,10 @@ func (o *VirtualSessionProvider) Exist(sid string) bool {
|
|||
func (o *VirtualSessionProvider) Destroy(sid string) error {
|
||||
o.lock.Lock()
|
||||
defer o.lock.Unlock()
|
||||
return o.provider.Destroy(sid)
|
||||
if o.provider.Exist(sid) {
|
||||
return o.provider.Destroy(sid)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Regenerate regenerates a session store from old session ID to new one.
|
||||
|
|
@ -195,3 +198,8 @@ func (s *VirtualStore) Flush() error {
|
|||
s.data = make(map[any]any)
|
||||
return nil
|
||||
}
|
||||
|
||||
// True if no keys have been set
|
||||
func (s *VirtualStore) Empty() bool {
|
||||
return len(s.data) == 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue