Versions in this module Expand all Collapse all v1 v1.1.0 Jul 10, 2024 Changes in this version + const CacheExpired + const CacheGcInterval + const CacheGcMaxRemoved + const CacheMaxMemory + var ErrCacheMiss = errors.New("xorm/cache: key not found") + var ErrNotExist = errors.New("Record does not exist") + var ErrNotStored = errors.New("xorm/cache: not stored") + func Decode(data []byte, to interface{}) error + func Encode(data interface{}) ([]byte, error) + func GenSqlKey(sql string, args interface{}) string + func GetCacheSql(m Cacher, tableName, sql string, args interface{}) ([]schemas.PK, error) + func GobDecode(data []byte, to interface{}) error + func GobEncode(data interface{}) ([]byte, error) + func JsonDecode(data []byte, to interface{}) error + func JsonEncode(data interface{}) ([]byte, error) + func Md5(str string) string + func PutCacheSql(m Cacher, ids []schemas.PK, tableName, sql string, args interface{}) error + type CacheStore interface + Del func(key string) error + Get func(key string) (interface{}, error) + Put func(key string, value interface{}) error + type Cacher interface + ClearBeans func(tableName string) + ClearIds func(tableName string) + DelBean func(tableName string, id string) + DelIds func(tableName, sql string) + GetBean func(tableName string, id string) interface{} + GetIds func(tableName, sql string) interface{} + PutBean func(tableName string, id string, obj interface{}) + PutIds func(tableName, sql string, ids interface{}) + type LRUCacher struct + Expired time.Duration + GcInterval time.Duration + MaxElementSize int + func NewLRUCacher(store CacheStore, maxElementSize int) *LRUCacher + func NewLRUCacher2(store CacheStore, expired time.Duration, maxElementSize int) *LRUCacher + func (m *LRUCacher) ClearBeans(tableName string) + func (m *LRUCacher) ClearIds(tableName string) + func (m *LRUCacher) DelBean(tableName string, id string) + func (m *LRUCacher) DelIds(tableName, sql string) + func (m *LRUCacher) GC() + func (m *LRUCacher) GetBean(tableName string, id string) interface{} + func (m *LRUCacher) GetIds(tableName, sql string) interface{} + func (m *LRUCacher) PutBean(tableName string, id string, obj interface{}) + func (m *LRUCacher) PutIds(tableName, sql string, ids interface{}) + func (m *LRUCacher) RunGC() + type LevelDBStore struct + Debug bool + func NewLevelDBStore(dbfile string) (*LevelDBStore, error) + func (s *LevelDBStore) Close() + func (s *LevelDBStore) Del(key string) error + func (s *LevelDBStore) Get(key string) (interface{}, error) + func (s *LevelDBStore) Put(key string, value interface{}) error + type Manager struct + func NewManager() *Manager + func (mgr *Manager) GetCacher(tableName string) Cacher + func (mgr *Manager) GetDefaultCacher() Cacher + func (mgr *Manager) SetCacher(tableName string, cacher Cacher) + func (mgr *Manager) SetDefaultCacher(cacher Cacher) + func (mgr *Manager) SetDisableGlobalCache(disable bool) + type MemoryStore struct + func NewMemoryStore() *MemoryStore + func (s *MemoryStore) Del(key string) error + func (s *MemoryStore) Get(key string) (interface{}, error) + func (s *MemoryStore) Put(key string, value interface{}) error