README

Build Status Coverage Status Go Report Card

SessionGate driver for the Go language

Driver for the SessionGate Redis module for easy session management in the Go language.

Documentation

https://godoc.org/github.com/f0rmiga/sessiongate-go

The Redis module

For more information about how the module works, refer to the module repository:

https://github.com/f0rmiga/sessiongate

How to run the tests

First you need a local running instance of Redis with the SessionGate module loaded (refer to the previous topic).

Then run:

go test

Expand ▾ Collapse ▴

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SignKey []byte

	Addr        string        // The Redis address
	MaxIdle     int           // The max idle time for a Redis connection
	IdleTimeout time.Duration // The idle timeout for a Redis connection
}

    Config represents a configuration passed to the Sessiongate initializer

    type Sessiongate

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

      A Sessiongate represents a connection to the SessionGate module loaded in the Redis server.

      func NewSessiongate

      func NewSessiongate(config *Config) (*Sessiongate, error)

        NewSessiongate initializes a new Sessiongate.

        func (*Sessiongate) End

        func (sessiongate *Sessiongate) End(token []byte) error

          End ends a session in the SessionGate module.

          func (*Sessiongate) Expire

          func (sessiongate *Sessiongate) Expire(token []byte, ttl int) error

            Expire sets the TTL for a session in the SessionGate module.

            func (*Sessiongate) PDel

            func (sessiongate *Sessiongate) PDel(token, name []byte) error

              PDel deletes a payload for a session in the SessionGate module name is the payload name to be used to delete.

              func (*Sessiongate) PGet

              func (sessiongate *Sessiongate) PGet(token, name []byte) ([]byte, error)

                PGet gets a payload for a session in the SessionGate module name is the payload name.

                func (*Sessiongate) PSet

                func (sessiongate *Sessiongate) PSet(token, name, payload []byte) error

                  PSet sets a payload for a session in the SessionGate module name is the payload name to be used to get the payload later

                  func (*Sessiongate) Start

                  func (sessiongate *Sessiongate) Start(ttl int) ([]byte, error)

                    Start starts a new session in the SessionGate module and returns the generated token.