Documentation ¶
Overview ¶
带redis缓存的数据库对象操作模块 使用者不需要对缓存进行管理,只需要实现从mysql读写数据的接口即可
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheDB ¶
type CacheDB struct {
// contains filtered or unexported fields
}
type DBObject ¶
type DBObject interface { //返回对象的ID,如果没有设置ID,则第二个返回值为false ID() (interface{}, bool) //缓存超时时间(秒),-1表示不超时,0表示默认值10分钟 Expire() int //新增或更新数据 Save(mysqldb *mysql.MysqlDB) (id interface{}, e error) //获取数据内容 Get(id interface{}, mysqldb *mysql.MysqlDB) (e error) //批量从数据库取数据 GetMap(ids []interface{}, mysqldb *mysql.MysqlDB) (objs map[interface{}]DBObject, e error) }
Click to show internal directories.
Click to hide internal directories.