flatten caches dir
This commit is contained in:
parent
8814370390
commit
38616e71fd
|
@ -1,5 +1,5 @@
|
||||||
//LRUCacher implements Cacher according to LRU algorithm
|
//LRUCacher implements Cacher according to LRU algorithm
|
||||||
package caches
|
package xorm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"container/list"
|
"container/list"
|
|
@ -1,17 +1,12 @@
|
||||||
// MemoryStore implements CacheStore provide local machine
|
// MemoryStore implements CacheStore provide local machine
|
||||||
package caches
|
package xorm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/go-xorm/core"
|
"github.com/go-xorm/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
ErrNotExist = errors.New("key not exist")
|
|
||||||
)
|
|
||||||
|
|
||||||
var _ core.CacheStore = NewMemoryStore()
|
var _ core.CacheStore = NewMemoryStore()
|
||||||
|
|
||||||
// memory store
|
// memory store
|
19
xorm.go
19
xorm.go
|
@ -11,7 +11,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-xorm/core"
|
"github.com/go-xorm/core"
|
||||||
"github.com/go-xorm/xorm/caches"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -95,14 +94,14 @@ func NewEngine(driverName string, dataSourceName string) (*Engine, error) {
|
||||||
return engine, err
|
return engine, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLRUCacher(store core.CacheStore, max int) *caches.LRUCacher {
|
// func NewLRUCacher(store core.CacheStore, max int) *LRUCacher {
|
||||||
return caches.NewLRUCacher(store, core.CacheExpired, core.CacheMaxMemory, max)
|
// return NewLRUCacher(store, core.CacheExpired, core.CacheMaxMemory, max)
|
||||||
|
// }
|
||||||
|
|
||||||
|
func NewLRUCacher2(store core.CacheStore, expired time.Duration, max int) *LRUCacher {
|
||||||
|
return NewLRUCacher(store, expired, 0, max)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLRUCacher2(store core.CacheStore, expired time.Duration, max int) *caches.LRUCacher {
|
// func NewMemoryStore() *MemoryStore {
|
||||||
return caches.NewLRUCacher(store, expired, 0, max)
|
// return NewMemoryStore()
|
||||||
}
|
// }
|
||||||
|
|
||||||
func NewMemoryStore() *caches.MemoryStore {
|
|
||||||
return caches.NewMemoryStore()
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue