1 Star 0 Fork 0

Stefan/xgameCommon

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
commitOper.go 946 Bytes
Copy Edit Raw Blame History
Stefan authored 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

Search