flatten caches dir

This commit is contained in:
Nash Tsai 2014-04-14 15:32:33 +08:00
parent 8814370390
commit 38616e71fd
3 changed files with 11 additions and 17 deletions

View File

@ -1,5 +1,5 @@
//LRUCacher implements Cacher according to LRU algorithm
package caches
package xorm
import (
"container/list"

View File

@ -1,17 +1,12 @@
// MemoryStore implements CacheStore provide local machine
package caches
package xorm
import (
"errors"
"sync"
"github.com/go-xorm/core"
)
var (
ErrNotExist = errors.New("key not exist")
)
var _ core.CacheStore = NewMemoryStore()
// memory store

19
xorm.go
View File

@ -11,7 +11,6 @@ import (
"time"
"github.com/go-xorm/core"
"github.com/go-xorm/xorm/caches"
)
const (
@ -95,14 +94,14 @@ func NewEngine(driverName string, dataSourceName string) (*Engine, error) {
return engine, err
}
func NewLRUCacher(store core.CacheStore, max int) *caches.LRUCacher {
return caches.NewLRUCacher(store, core.CacheExpired, core.CacheMaxMemory, max)
// func NewLRUCacher(store core.CacheStore, max int) *LRUCacher {
// 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 {
return caches.NewLRUCacher(store, expired, 0, max)
}
func NewMemoryStore() *caches.MemoryStore {
return caches.NewMemoryStore()
}
// func NewMemoryStore() *MemoryStore {
// return NewMemoryStore()
// }