mirror of
https://github.com/kataras/iris.git
synced 2026-01-08 20:41:57 +00:00
formatting
Former-commit-id: 037081db5d6d4434e873ca8b75334ee43e046b6a
This commit is contained in:
@@ -134,7 +134,6 @@ func (db *Database) Acquire(sid string, expires time.Duration) sessions.LifeTime
|
||||
|
||||
if !hasExpiration {
|
||||
return sessions.LifeTime{}
|
||||
|
||||
}
|
||||
|
||||
return sessions.LifeTime{Time: time.Now().Add(time.Duration(seconds) * time.Second)}
|
||||
|
||||
@@ -114,13 +114,12 @@ func (r *RadixDriver) Set(key string, value interface{}, secondsLifetime int64)
|
||||
}
|
||||
|
||||
// Get returns value, err by its key
|
||||
//returns nil and a filled error if something bad happened.
|
||||
// returns nil and a filled error if something bad happened.
|
||||
func (r *RadixDriver) Get(key string) (interface{}, error) {
|
||||
var redisVal interface{}
|
||||
mn := radix.MaybeNil{Rcv: &redisVal}
|
||||
|
||||
err := r.pool.Do(radix.Cmd(&mn, "GET", r.Config.Prefix+key))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -197,7 +196,6 @@ func (r *RadixDriver) GetAll() (interface{}, error) {
|
||||
var redisVal []interface{}
|
||||
mn := radix.MaybeNil{Rcv: &redisVal}
|
||||
err := r.pool.Do(radix.Cmd(&mn, "SCAN", strconv.Itoa(0))) // 0 -> cursor
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func (r *RedigoDriver) Set(key string, value interface{}, secondsLifetime int64)
|
||||
}
|
||||
|
||||
// Get returns value, err by its key
|
||||
//returns nil and a filled error if something bad happened.
|
||||
// returns nil and a filled error if something bad happened.
|
||||
func (r *RedigoDriver) Get(key string) (interface{}, error) {
|
||||
c := r.pool.Get()
|
||||
defer c.Close()
|
||||
@@ -79,7 +79,6 @@ func (r *RedigoDriver) Get(key string) (interface{}, error) {
|
||||
}
|
||||
|
||||
redisVal, err := c.Do("GET", r.Config.Prefix+key)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -108,7 +107,6 @@ func (r *RedigoDriver) TTL(key string) (seconds int64, hasExpiration bool, found
|
||||
|
||||
func (r *RedigoDriver) updateTTLConn(c redis.Conn, key string, newSecondsLifeTime int64) error {
|
||||
reply, err := c.Do("EXPIRE", r.Config.Prefix+key, newSecondsLifeTime)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -175,7 +173,6 @@ func (r *RedigoDriver) GetAll() (interface{}, error) {
|
||||
}
|
||||
|
||||
redisVal, err := c.Do("SCAN", 0) // 0 -> cursor
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -234,7 +231,7 @@ func (r *RedigoDriver) GetKeys(prefix string) ([]string, error) {
|
||||
|
||||
// GetBytes returns value, err by its key
|
||||
// you can use utils.Deserialize((.GetBytes("yourkey"),&theobject{})
|
||||
//returns nil and a filled error if something wrong happens
|
||||
// returns nil and a filled error if something wrong happens
|
||||
func (r *RedigoDriver) GetBytes(key string) ([]byte, error) {
|
||||
c := r.pool.Get()
|
||||
defer c.Close()
|
||||
@@ -243,7 +240,6 @@ func (r *RedigoDriver) GetBytes(key string) ([]byte, error) {
|
||||
}
|
||||
|
||||
redisVal, err := c.Do("GET", r.Config.Prefix+key)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user