redis

package
v3.0.0-rc.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Provider is the redis provider
	Provider = sessions.NewProvider("redis")

	// Config is just the Redis(service)' config
	Config = redis.Config
)

Functions

This section is empty.

Types

type Store

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

Store the redis session store

func NewStore

func NewStore(sid string, cookieLifeDuration time.Duration) *Store

NewStore creates and returns a new store based on the session id(string) and the cookie life duration (time.Duration)

func (*Store) Clear

func (s *Store) Clear() error

Clear removes all entries returns an error, which is always nil

func (*Store) Delete

func (s *Store) Delete(key interface{}) error

Delete removes an entry by its key returns an error, which is always nil

func (*Store) Destroy

func (s *Store) Destroy()

Destroy deletes entirely the session, from the memory, the client's cookie and the store

func (*Store) Get

func (s *Store) Get(key interface{}) interface{}

Get returns the value of an entry by its key

func (*Store) GetAll

func (s *Store) GetAll() map[interface{}]interface{}

GetAll returns all values

func (*Store) GetInt

func (s *Store) GetInt(key interface{}) int

GetInt same as Get but returns as int, if nil then returns -1

func (*Store) GetString

func (s *Store) GetString(key interface{}) string

GetString same as Get but returns as string, if nil then returns an empty string

func (*Store) ID

func (s *Store) ID() string

ID returns the session id

func (*Store) LastAccessedTime

func (s *Store) LastAccessedTime() time.Time

LastAccessedTime returns the last time this session has been used

func (*Store) Set

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

Set fills the session with an entry, it receives a key and a value returns an error, which is always nil

func (*Store) SetLastAccessedTime

func (s *Store) SetLastAccessedTime(lastacc time.Time)

SetLastAccessedTime updates the last accessed time

func (*Store) VisitAll

func (s *Store) VisitAll(cb func(k interface{}, v interface{}))

VisitAll loop each one entry and calls the callback function func(key,value)

type Values

type Values map[interface{}]interface{}

Values is just a type of a map[interface{}]interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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