boltdb

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultFileMode = 0666
)

DefaultFileMode used as the default database's "fileMode" for creating the sessions directory path, opening and write the session boltdb(file-based) storage.

View Source
var (
	// ErrOptionsMissing returned on `New` when path or tableName are empty.
	ErrOptionsMissing = errors.New("required options are missing")
)

Functions

This section is empty.

Types

type Database

type Database struct {

	// Service is the underline BoltDB database connection,
	// it's initialized at `New` or `NewFromDB`.
	// Can be used to get stats.
	Service *bolt.DB
	// contains filtered or unexported fields
}

Database the BoltDB(file-based) session storage.

func New

func New(path string, fileMode os.FileMode, bucketName string) (*Database, error)

New creates and returns a new BoltDB(file-based) storage instance based on the "path". Path should include the filename and the directory(aka fullpath), i.e sessions/store.db.

It will remove any old session files.

func NewFromDB

func NewFromDB(service *bolt.DB, bucketName string) (*Database, error)

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

func (*Database) Async

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

Async if true passed then it will use different go routines to update the BoltDB(file-based) storage.

func (*Database) Cleanup

func (db *Database) Cleanup() 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 BoltDB connection.

func (*Database) Len

func (db *Database) Len() (num int)

Len reports the number of sessions that are stored to the this BoltDB table.

func (*Database) Load

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

Load loads the sessions from the BoltDB(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