feat(kv): persist cache and session into disk before shutdown

This commit is contained in:
Aaron Liu
2023-04-16 09:17:06 +08:00
parent 4d131db504
commit b9d9e036c9
12 changed files with 347 additions and 57 deletions

View File

@@ -0,0 +1,22 @@
package sessionstore
import (
"github.com/cloudreve/Cloudreve/v3/pkg/cache"
"github.com/gin-contrib/sessions"
)
type Store interface {
sessions.Store
}
func NewStore(driver cache.Driver, keyPairs ...[]byte) Store {
return &store{newKvStore("cd_session_", driver, keyPairs...)}
}
type store struct {
*kvStore
}
func (c *store) Options(options sessions.Options) {
c.kvStore.Options = options.ToGorillaOptions()
}