mongodb

package
v2.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConnectionUrl string

	Database string

	Collection string
}

func NewConfigWith

func NewConfigWith(connectionUrl string, dbName string, collection string) Config

NewConfigWith returns a new configuration with specific parameters

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (*Provider, error)

New returns a new configured mongodb provider

func (*Provider) Count

func (p *Provider) Count() int

Count returns the total of stored sessions

func (*Provider) Destroy

func (p *Provider) Destroy(id []byte) error

Destroy destroys the session from the given id

func (*Provider) GC

func (p *Provider) GC() error

GC destroys the expired sessions

func (*Provider) Get

func (p *Provider) Get(id []byte) ([]byte, error)

Get returns the session value stored in the database.

func (*Provider) NeedGC

func (p *Provider) NeedGC() bool

NeedGC indicates if the GC needs to be run

func (*Provider) Regenerate

func (p *Provider) Regenerate(id []byte, newID []byte, expiration time.Duration) error

Regenerate updates the session id and expiration with the new session id of the the given current session id

func (*Provider) Save

func (p *Provider) Save(id []byte, data []byte, expiration time.Duration) error

Save saves the session data and expiration from the given session id

Jump to

Keyboard shortcuts

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