update
This commit is contained in:
8
cache/cache.go
vendored
8
cache/cache.go
vendored
@@ -1,14 +1,14 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"code.infininov.com/Infini/unitech-golib/tlog"
|
||||
"errors"
|
||||
"github.com/MAN00K/unitech_golib/tlog"
|
||||
"github.com/creachadair/cityhash"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
//API
|
||||
// API
|
||||
var Nil error = errors.New("cache: nil")
|
||||
|
||||
func Set(key string, value interface{}) error {
|
||||
@@ -27,7 +27,7 @@ func Del(key string) error {
|
||||
return del(key)
|
||||
}
|
||||
|
||||
//internal
|
||||
// internal
|
||||
var dbs map[byte]*db
|
||||
|
||||
type db struct {
|
||||
@@ -59,7 +59,7 @@ func newdb(t time.Duration) *db {
|
||||
return ret
|
||||
}
|
||||
|
||||
//定期扫描过期的key
|
||||
// 定期扫描过期的key
|
||||
func (this *db) flush() {
|
||||
for range time.NewTicker(this.t).C {
|
||||
this.doflush()
|
||||
|
||||
Reference in New Issue
Block a user