1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-23 12:57:05 +00:00
Files
kararas_iris/sessions/sessiondb/redis/driver.go
Gerasimos (Makis) Maropoulos a8a3afea22 update dependencies
2025-08-15 23:29:20 +03:00

31 lines
838 B
Go

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(sid, key string, value any) error
Get(sid, key string) (any, 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 = (*GoRedisDriver)(nil)
)
// 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{}
}