badger

package
v10.5.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultFileMode = 0755
)

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.DB
}

Database the badger(key-value file-based) session storage.

func New

func New(directoryPath string) (*Database, error)

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

func NewFromDB(service *badger.DB) (*Database, error)

NewFromDB same as `New` but accepts an already-created custom badger connection instead.

func (*Database) Async

func (db *Database) Async(useGoRoutines bool) *Database

Async is DEPRECATED if it was true then it could use different to update the back-end storage, now it does nothing.

func (*Database) Cleanup

func (db *Database) Cleanup() (err error)

Cleanup removes any invalid(have expired) session entries, it's being called automatically on `New` as well.

func (*Database) Close

func (db *Database) Close() error

Close shutdowns the badger connection.

func (*Database) Load

func (db *Database) Load(sid string) (storeDB sessions.RemoteStore)

Load loads the sessions from the badger(key-value file-based) session storage.

func (*Database) Sync

func (db *Database) Sync(p sessions.SyncPayload)

Sync syncs the database with the session's (memory) store.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL