Skip to content

gorilla sessions.Store implementation using radix as a client

License

Notifications You must be signed in to change notification settings

venezia/gorillaradix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gorillaradix

gorillaradix is a gorilla sessions.Store using radix as its persistence layer.

It supports vanilla redis and redis cluster

Quickstart

To use this library you'd need to do something like:

Vanilla redis

store, err := gorillaradix.NewStore(gorillaradix.PoolConfiguration{
	Host: "my-redis-host:6379",
	ConnectionOptions: gorillaradix.ConnectionOptions{
		Password:    "terriblePassword",
		PingTimeout: 10 * time.Second,
		Timeout:     1 * time.Minute,
	    },
	}, gorillaradix.SessionOptions{
	Secret:      "terribleSecret",
})

redis cluster

store, err := gorillaradix.NewStoreCluster(gorillaradix.PoolConfiguration{
	Hosts: []string{"my-cluster-host-1:6379", "my-cluster-host-2:6379"},
	ConnectionOptions: gorillaradix.ConnectionOptions{
		Password:    "terriblePassword",
		PingTimeout: 10 * time.Second,
		Timeout:     1 * time.Minute,
	    },
	}, gorillaradix.SessionOptions{
	Secret:      "terribleSecret",
})

Options

While there are reasonable defaults provided by the library, there are a number of variables to customize this session store.

Notable session options:

Variable Description Default
KeyPrefix Start session keys in redis with this string session_
MaxAge How long session data should be retained in seconds 86400
MaxLength How much data should a session be able to store in bytes 32768
Path What path should the cookie be set to /
Secret Secret (as a string) to validate session cookies notAGreatSecret

Dependencies

  • github.com/gorilla/sessions
  • github.com/gorilla/securecookie
  • github.com/mediocregopher/radix

FAQ

Why use the radix library?

It is one of the two client libraries recommended by the redis project

About

gorilla sessions.Store implementation using radix as a client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages