file

package
v10.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 10, 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 {
	// contains filtered or unexported fields
}

Database is the basic file-storage session database.

What it does It removes old(expired) session files, at init (`Cleanup`). It creates a session file on the first inserted key-value session data. It removes a session file on destroy. It sync the session file to the session's memstore on any other action (insert, delete, clear). It automatically remove the session files on runtime when a session is expired.

Remember: sessions are not a storage for large data, everywhere: on any platform on any programming language.

func New

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

New creates and returns a new file-storage database instance based on the "directoryPath". DirectoryPath should is the directory which the leveldb database will store the sessions, i.e ./sessions/

It will remove any old session files.

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() error

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

func (*Database) FileMode

func (db *Database) FileMode(fileMode uint32) *Database

FileMode for creating the sessions directory path, opening and write the session file.

Defaults to 0755.

func (*Database) Load

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

Load loads the values from the storage and returns them

func (*Database) Sync

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

Sync syncs the database.

Jump to

Keyboard shortcuts

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