mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 19:00:54 +00:00
createdTime typo fixed
This commit is contained in:
parent
8aed4c13d7
commit
3821b2cb26
12
cache/memory.go
vendored
12
cache/memory.go
vendored
@ -27,11 +27,11 @@ var (
|
|||||||
DefaultEvery = 60 // 1 minute
|
DefaultEvery = 60 // 1 minute
|
||||||
)
|
)
|
||||||
|
|
||||||
// MemoryItem store enery cache item.
|
// MemoryItem store memory cache item.
|
||||||
type MemoryItem struct {
|
type MemoryItem struct {
|
||||||
val interface{}
|
val interface{}
|
||||||
cratedTime time.Time
|
createdTime time.Time
|
||||||
lifespan int64
|
lifespan int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mi *MemoryItem) isExpire() bool {
|
func (mi *MemoryItem) isExpire() bool {
|
||||||
@ -39,7 +39,7 @@ func (mi *MemoryItem) isExpire() bool {
|
|||||||
if mi.lifespan == 0 {
|
if mi.lifespan == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return time.Now().Unix()-mi.cratedTime.Unix() > mi.lifespan
|
return time.Now().Unix()-mi.createdTime.Unix() > mi.lifespan
|
||||||
}
|
}
|
||||||
|
|
||||||
// MemoryCache is Memory cache adapter.
|
// MemoryCache is Memory cache adapter.
|
||||||
@ -88,7 +88,7 @@ func (bc *MemoryCache) Put(name string, value interface{}, lifespan int64) error
|
|||||||
defer bc.Unlock()
|
defer bc.Unlock()
|
||||||
bc.items[name] = &MemoryItem{
|
bc.items[name] = &MemoryItem{
|
||||||
val: value,
|
val: value,
|
||||||
cratedTime: time.Now(),
|
createdTime: time.Now(),
|
||||||
lifespan: lifespan,
|
lifespan: lifespan,
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user