代码拉取完成,页面将自动刷新
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)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。