Documentation ¶
Index ¶
- Variables
- func AssignNewSessionID(s *Session) error
- func Init()
- func Release()
- func Remove(id string)
- type Session
- func (s *Session) CacheDelete(key interface{})
- func (s *Session) CacheGet(key interface{}, vars ...func() interface{}) (value interface{}, ok bool)
- func (s *Session) CacheSet(key interface{}, value interface{})
- func (s *Session) Delete(key interface{})
- func (s *Session) Dirty()
- func (s *Session) Get(key interface{}, vars ...func() interface{}) (value interface{}, ok bool)
- func (s *Session) ID() string
- func (s *Session) Lock() bool
- func (s *Session) Set(key interface{}, value interface{})
- func (s *Session) Unlock()
Constants ¶
This section is empty.
Variables ¶
var ( // Public ErrNotFound = errors.New("store: the session with the corresponding ID does not exists") )
Functions ¶
func AssignNewSessionID ¶
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.
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
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 ¶
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) Lock ¶
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.