store

package
v0.0.0-...-55d16bb Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Public
	ErrNotFound = errors.New("store: the session with the corresponding ID does not exists")
)

Functions

func AssignNewSessionID

func AssignNewSessionID(s *Session) error

AssignNewSessionID invalidates the old ID and creates a new ID for the session. This operation is thread-safe.

func Init

func Init()

Init initializes this store package. This is handled by the main bulldozer package.

func Release

func Release()

Release releases this store package. This is handled by the main bulldozer package.

func Remove

func Remove(id string)

Remove removes the session completly from the cache and database This operation is thread-safe.

Types

type Session

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

func Get

func Get(id string) (*Session, error)

Get will return a session fitting to the session ID. This operation is thread-safe.

func New

func New() (*Session, error)

New will create and return a new session. This operation is thread-safe.

func (*Session) CacheDelete

func (s *Session) CacheDelete(key interface{})

CacheDelete removes the cache value with the given key. This operation is thread-safe.

func (*Session) CacheGet

func (s *Session) CacheGet(key interface{}, vars ...func() interface{}) (value interface{}, ok bool)

CacheGet obtains the cache value. A single variadic argument is accepted, and it is optional: if a function is set, this function will be called if no value exists for the given key. This operation is thread-safe.

func (*Session) CacheSet

func (s *Session) CacheSet(key interface{}, value interface{})

CacheSet sets the cache value with the given key. This operation is thread-safe.

func (*Session) Delete

func (s *Session) Delete(key interface{})

Delete removes the value with the given key. This operation is thread-safe.

func (*Session) Dirty

func (s *Session) Dirty()

Dirty sets the session values to an unsaved state, which will trigger the save trigger handler. Use this method, if you don't want to always call the Set() method for pointer values.

func (*Session) Get

func (s *Session) Get(key interface{}, vars ...func() interface{}) (value interface{}, ok bool)

Get obtains the value. A single variadic argument is accepted, and it is optional: if a function is set, this function will be called if no value exists for the given key. This operation is thread-safe.

func (*Session) ID

func (s *Session) ID() string

ID returns the unique session ID. Don't expose this information.

func (*Session) Lock

func (s *Session) Lock() bool

Lock increments the lock count. If you call lock, you have to also call unlock. This method returns true, if the lock was successful. Otherwise, if this session is already released from cache, this will return false. Then, you should obtain a new session with store.Get. This operation is thread-safe.

func (*Session) Set

func (s *Session) Set(key interface{}, value interface{})

Set sets the value with the given key. This operation is thread-safe.

func (*Session) Unlock

func (s *Session) Unlock()

Unlock decrements the lock count. If this session is not more locked by any lock, then this session will be released from cache. This operation is thread-safe.

Directories

Path Synopsis
Package protobuf is a generated protocol buffer package.
Package protobuf is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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