Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 is DEPRECATED if it was true then it could use different to update the back-end storage, now it does nothing.
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 0755.