1 Star 0 Fork 0

Stefan/xgameCommon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
commitOper.go 946 Bytes
一键复制 编辑 原始数据 按行查看 历史
Stefan 提交于 2020-05-09 19:48 +08:00 . add common file.
package dbCache
/*
purpose: db commit from logic opertion.
date: 20200113 14:45
*/
// push model for db cache, record flush db times, at next flush db, then judge last flush or not, if yes then get data from cache.
func PushCommitModels(identify string, models ...string) {
cache := GetDBCache()
for _, m := range models {
cache.push(identify, m)
}
}
// check model is exist, if not then flush db direct.
func HasExistCache(identify string, model string) bool {
cache := GetDBCache()
return cache.hasExist(identify, model)
}
// first commit all update, then pop all push models.
func PopCommitModels(identify string) {
cache := GetDBCache()
cache.updateDB(identify)
cache.pop(identify)
}
// offline or other operate to force commit.
func ProtectCommit(identify string) {
PopCommitModels(identify)
}
func UpdateDBCache(identify string, model string, data []byte) bool {
return GetDBCache().updateCache(identify, model, data)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/stefan886/xgameCommon.git
git@gitee.com:stefan886/xgameCommon.git
stefan886
xgameCommon
xgameCommon
v0.0.5

搜索帮助