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 {
// 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 ¶
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 ¶
Async if true passed then it will use go routines to: append or re-write a file create a file remove a file.
Defaults to false.
func (*Database) Cleanup ¶
Cleanup removes any invalid(have expired) session files, it's being called automatically on `New` as well.
func (*Database) FileMode ¶
FileMode for creating the sessions directory path, opening and write the session file.
Defaults to 0666.