session

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocal

func GetLocal[T any](localSession *Local, key []byte) (*T, error)

GetLocal is getting the value of given key. if not exists, return Not Exists Error. if not match type with generic, return Not Match Type Error.

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists is a function to check given error is Already Exists Error

func IsNotExists

func IsNotExists(err error) bool

IsNotExists is a function to check given error is Not Exists Error

func IsNotMatchType

func IsNotMatchType(err error) bool

IsNotMatchType is a function to check given error is Not Match Type Error

func IsTimeout

func IsTimeout(err error) bool

IsTimeout is a function to check given error is Time Out Error

func RemoveLocal

func RemoveLocal[T any](localSession *Local, key []byte) (*T, error)

RemoveLocal is deleting key value pair in local session. if not exists, return Not Exists Error. if not match type with generic, return Not Match Type Error.

func SetLocal

func SetLocal[T any](localSession *Local, key []byte, value T) error

SetLocal is setting value of key into local session. if already exists key value pair in local session, return Already Exists Error.

func StartGC

func StartGC(localSession *Local)

StartGC is starting GC process

Types

type Local

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

Local is a session of app scope

func NewLocal

func NewLocal() *Local

NewLocal create new Local instance

func (*Local) DecreaseCount

func (l *Local) DecreaseCount()

DecreaseCount is decreasing count of local session

func (*Local) IncreaseCount

func (l *Local) IncreaseCount()

IncreaseCount is increasing count of local session

func (*Local) SetTTL

func (l *Local) SetTTL(duration time.Duration)

SetTTL set Local's ttl to given duration

Jump to

Keyboard shortcuts

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