-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
redis sessiondb: support more than one driver - builtin redigo(defaul…
…t) and radix - rel to: #1328
- Loading branch information
Showing
7 changed files
with
498 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package redis | ||
|
||
// 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 | ||
} | ||
|
||
var ( | ||
_ Driver = (*RedigoDriver)(nil) | ||
_ Driver = (*RadixDriver)(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{} | ||
} |
Oops, something went wrong.