Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
DefaultFileMode = 0666
)
DefaultFileMode used as the default database's "fileMode" for creating the sessions directory path, opening and write the session file.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { // Service is the underline badger database connection, // it's initialized at `New` or `NewFromDB`. // Can be used to get stats. Service *badger.KV // contains filtered or unexported fields }
Database the badger(key-value file-based) session storage.
func New ¶
New creates and returns a new badger(key-value file-based) storage instance based on the "directoryPath". DirectoryPath should is the directory which the badger database will store the sessions, i.e ./sessions
It will remove any old session files.
func NewFromDB ¶
NewFromDB same as `New` but accepts an already-created custom badger connection instead.
func (*Database) Async ¶
Async if true passed then it will use different go routines to update the badger(key-value file-based) storage.
func (*Database) Cleanup ¶
Cleanup removes any invalid(have expired) session entries, it's being called automatically on `New` as well.