memory

package module
v0.0.0-...-992d285 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store represents in-memory session store

func New

func New() *Store

New creates a new in-memory store instance

func (*Store) Bool

func (s *Store) Bool(r interface{}, err error) (bool, error)

Bool is a helper method to type assert as Bool

func (*Store) Bytes

func (s *Store) Bytes(r interface{}, err error) ([]byte, error)

Bytes is a helper method to type assert as Bytes

func (*Store) Clear

func (s *Store) Clear(sess *simplesessions.Session, id string) error

Clear clears session in redis.

func (*Store) Commit

func (s *Store) Commit(sess *simplesessions.Session, id string) error

Commit does nothing here since Set sets the value.

func (*Store) Create

func (s *Store) Create(sess *simplesessions.Session) (string, error)

Create creates a new session id and returns it. This doesn't create the session in sessions map since memory can be saved by not storing empty sessions and system can not be stressed by just creating new sessions

func (*Store) Delete

func (s *Store) Delete(sess *simplesessions.Session, id string, key string) error

Delete deletes a key from session.

func (*Store) Float64

func (s *Store) Float64(r interface{}, err error) (float64, error)

Float64 is a helper method to type assert as Float64

func (*Store) Get

func (s *Store) Get(sess *simplesessions.Session, id, key string) (interface{}, error)

Get gets a field in session

func (*Store) GetAll

func (s *Store) GetAll(sess *simplesessions.Session, id string) (map[string]interface{}, error)

GetAll gets all fields in session

func (*Store) GetMulti

func (s *Store) GetMulti(sess *simplesessions.Session, id string, keys ...string) (map[string]interface{}, error)

GetMulti gets a map for values for multiple keys. If key is not present in session then nil is returned.

func (*Store) Int

func (s *Store) Int(r interface{}, err error) (int, error)

Int is a helper method to type assert as integer

func (*Store) Int64

func (s *Store) Int64(r interface{}, err error) (int64, error)

Int64 is a helper method to type assert as Int64

func (*Store) IsValid

func (s *Store) IsValid(sess *simplesessions.Session, id string) (bool, error)

IsValid checks if the session is set for the id

func (*Store) Set

func (s *Store) Set(sess *simplesessions.Session, id, key string, val interface{}) error

Set sets a value to given session but stored only on commit

func (*Store) String

func (s *Store) String(r interface{}, err error) (string, error)

String is a helper method to type assert as String

func (*Store) UInt64

func (s *Store) UInt64(r interface{}, err error) (uint64, error)

UInt64 is a helper method to type assert as UInt64

Jump to

Keyboard shortcuts

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