mirror of
https://github.com/kataras/iris.git
synced 2025-12-27 06:47:08 +00:00
@@ -1,34 +1,30 @@
|
||||
package redis
|
||||
|
||||
import "time"
|
||||
|
||||
// Driver is the interface which each supported redis client
|
||||
// should support in order to be used in the redis session database.
|
||||
type Driver interface {
|
||||
Connect(c Config) error
|
||||
PingPong() (bool, error)
|
||||
CloseConnection() error
|
||||
Set(key string, value interface{}, secondsLifetime int64) error
|
||||
Get(key string) (interface{}, error)
|
||||
TTL(key string) (seconds int64, hasExpiration bool, found bool)
|
||||
UpdateTTL(key string, newSecondsLifeTime int64) error
|
||||
UpdateTTLMany(prefix string, newSecondsLifeTime int64) error
|
||||
GetAll() (interface{}, error)
|
||||
GetKeys(prefix string) ([]string, error)
|
||||
Delete(key string) error
|
||||
Set(sid, key string, value interface{}) error
|
||||
Get(sid, key string) (interface{}, error)
|
||||
Exists(sid string) bool
|
||||
TTL(sid string) time.Duration
|
||||
UpdateTTL(sid string, newLifetime time.Duration) error
|
||||
GetAll(sid string) (map[string]string, error)
|
||||
GetKeys(sid string) ([]string, error)
|
||||
Len(sid string) int
|
||||
Delete(sid, key string) error
|
||||
}
|
||||
|
||||
var (
|
||||
_ Driver = (*RedigoDriver)(nil)
|
||||
_ Driver = (*RadixDriver)(nil)
|
||||
_ Driver = (*GoRedisDriver)(nil)
|
||||
)
|
||||
|
||||
// Redigo returns the driver for the redigo go redis client.
|
||||
// Which is the default one.
|
||||
// You can customize further any specific driver's properties.
|
||||
func Redigo() *RedigoDriver {
|
||||
return &RedigoDriver{}
|
||||
}
|
||||
|
||||
// Radix returns the driver for the radix go redis client.
|
||||
func Radix() *RadixDriver {
|
||||
return &RadixDriver{}
|
||||
// GoRedis returns the default Driver for the redis sessions database
|
||||
// It's the go-redis client. Learn more at: https://github.com/go-redis/redis.
|
||||
func GoRedis() *GoRedisDriver {
|
||||
return &GoRedisDriver{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user