boltSession

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2016 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package boltSession provides a Service that is using local BoltDB database to store Session data.

+build linux

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(filename string, fileMode os.FileMode, boltOptions *bolt.Options) (db *bolt.DB, err error)

NewDB opens a new BoltDB database.

Types

type Service

type Service struct {
	DB *bolt.DB

	// DefaultLifetime is a period how long a session is valid if
	// no MaxTime is provided.
	DefaultLifetime time.Duration
	// CleanupPeriod defines a period on which deletion of expired
	// session is executed.
	CleanupPeriod time.Duration
}

Service implements gopherpit.com/gopherpit/services/session.Service interface.

func (Service) CreateSession

func (s Service) CreateSession(o *session.Options) (*session.Session, error)

CreateSession creates a new Session in a BoltDB database.

func (Service) DeleteSession

func (s Service) DeleteSession(id string) error

DeleteSession deletes an existing Session.

func (Service) PeriodicCleanup

func (s Service) PeriodicCleanup(logger *logging.Logger) (err error)

PeriodicCleanup deletes expired session on a period defined in Service.CleanupPeriod.

func (Service) Session

func (s Service) Session(id string) (*session.Session, error)

Session retrieves a Session instance from a BoltDB database.

func (Service) UpdateSession

func (s Service) UpdateSession(id string, o *session.Options) (*session.Session, error)

UpdateSession changes data of an existing Session.

Jump to

Keyboard shortcuts

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