mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
Add the article 'CRUD REST API in Iris (a framework for golang)' and a starter kit for Iris written by @jebzmos4
Former-commit-id: 72eb72f11086b23c1bf849eb14ad846492a84cbd
This commit is contained in:
@@ -174,7 +174,8 @@ func (db *Database) Acquire(sid string, expires time.Duration) (lifetime session
|
||||
return err
|
||||
}
|
||||
|
||||
if err := b.Put(expirationKey, timeBytes); err == nil {
|
||||
err = b.Put(expirationKey, timeBytes)
|
||||
if err == nil {
|
||||
// create the session bucket now, so the rest of the calls can be easly get the bucket without any further checks.
|
||||
_, err = root.CreateBucket(bsid)
|
||||
}
|
||||
@@ -366,11 +367,7 @@ func (db *Database) Release(sid string) {
|
||||
// try to delete the associated expiration bucket, if exists, ignore error.
|
||||
b.DeleteBucket(getExpirationBucketName(bsid))
|
||||
|
||||
if err := b.DeleteBucket(bsid); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return b.DeleteBucket(bsid)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package service
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gomodule/redigo/redis"
|
||||
"github.com/kataras/iris/core/errors"
|
||||
)
|
||||
@@ -94,7 +95,7 @@ func (r *Service) TTL(key string) (seconds int64, hasExpiration bool, found bool
|
||||
// if -1 means the key has unlimited life time.
|
||||
hasExpiration = seconds > -1
|
||||
// if -2 means key does not exist.
|
||||
found = ! (c.Err() != nil || seconds == -2)
|
||||
found = !(c.Err() != nil || seconds == -2)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user