boltSession

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2017 License: BSD-3-Clause Imports: 16 Imported by: 1

Documentation

Overview

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

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 Logger added in v0.4.1

type Logger interface {
	Debug(a ...interface{})
	Debugf(format string, a ...interface{})
	Info(a ...interface{})
	Errorf(format string, a ...interface{})
}

Logger defines interface for logging messages with various severity levels.

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
	Logger        Logger
}

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) DataDump added in v0.2.1

func (s Service) DataDump(ifModifiedSince *time.Time) (dump *dataDump.Dump, err error)

DataDump implements dataDump.Interface interface to extract database data in a safe and reliable way.

func (Service) DeleteSession

func (s Service) DeleteSession(id string) error

DeleteSession deletes an existing Session.

func (Service) PeriodicCleanup

func (s Service) PeriodicCleanup() (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