Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
BadgerStore represents the session store.
func New ¶
func New(db *badger.DB) *BadgerStore
New returns a new BadgerStore instance. The db parameter should be a pointer to a badger store instance.
func NewWithPrefix ¶
func NewWithPrefix(db *badger.DB, prefix string) *BadgerStore
NewWithPrefix returns a new BadgerStore instance. The db parameter should be a pointer to a badger store instance. The prefix parameter controls the Badger key prefix, which can be used to avoid naming clashes if necessary.
func (*BadgerStore) All ¶
func (bs *BadgerStore) All() (map[string][]byte, error)
All returns a map containing the token and data for all active (i.e. not expired) sessions in the BadgerStore instance.
func (*BadgerStore) Commit ¶
Commit adds a session token and data to the BadgerStore instance with the given expiry time. If the session token already exists then the data and expiry time are updated.
func (*BadgerStore) Delete ¶
func (bs *BadgerStore) Delete(token string) error
Delete removes a session token and corresponding data from the BadgerStore instance.