Documentation ¶
Overview ¶
Package boltstore is a boltdb based session store for the SCS session package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltStore ¶
type BoltStore struct {
// contains filtered or unexported fields
}
BoltStore is a SCS session store backed by a boltdb file.
func New ¶
New creates a BoltStore instance.
The cleanupInterval parameter controls how frequently expired session data is removed by the background cleanup goroutine. Setting it to 0 prevents the cleanup goroutine from running (i.e. expired sessions will not be removed).
func (*BoltStore) Find ¶
Find returns the data for a session token. If the session token is not found or is expired, the exists flag will be false.
func (*BoltStore) Save ¶
Save updates data for a given session token with a given expiry. Any existing data + expiry will be over-written.
func (*BoltStore) StopCleanup ¶
func (bs *BoltStore) StopCleanup()
StopCleanup terminates the background cleanup goroutine for the BoltStore instance. It's rare to terminate this; generally BoltStore instances and their cleanup goroutines are intended to be long-lived and run for the lifetime of your application.
There may be occasions though when your use of the BoltStore is transient. An example is creating a new BoltStore instance in a test function. In this scenario, the cleanup goroutine (which will run forever) will prevent the BoltStore object from being garbage collected even after the test function has finished. You can prevent this by manually calling StopCleanup.