mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-15 08:17:24 +00:00
feat[orm]: unsafe updates entity immediatly
This commit is contained in:
1 parent
f0a4a8e994
commit
5f75c53ef2
2 files changed
+15
No files matched your search
@@ -185,6 +185,16 @@ public class EntityCache<PK extends Comparable<PK>, E extends IEntity<PK>> imple
|
|||||||
currentPnode.setWriteToDbTime(now);
|
currentPnode.setWriteToDbTime(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUnsafeNow(E entity) {
|
||||||
|
updateUnsafe(entity);
|
||||||
|
OrmContext.getAccessor().update(entity);
|
||||||
|
var currentPnode = cache.getIfPresent(entity.id());
|
||||||
|
var now = TimeUtils.now();
|
||||||
|
currentPnode.setModifiedTime(now);
|
||||||
|
currentPnode.setWriteToDbTime(now);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate(PK pk) {
|
public void invalidate(PK pk) {
|
||||||
// 游戏业务中,操作最频繁的是update,不是insert,delete,query
|
// 游戏业务中,操作最频繁的是update,不是insert,delete,query
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ public interface IEntityCache<PK extends Comparable<PK>, E extends IEntity<PK>>
|
|||||||
*/
|
*/
|
||||||
void updateNow(E entity);
|
void updateNow(E entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同updateNow(),不会校验更新的线程是否一致
|
||||||
|
*/
|
||||||
|
void updateUnsafeNow(E entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 不会删除数据库中的数据,只会删除缓存数据
|
* 不会删除数据库中的数据,只会删除缓存数据
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in new issue
Block a user