mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-05-19 11:26:34 +00:00
feat[orm]: unsafe updates entity immediatly
This commit is contained in:
@@ -185,6 +185,16 @@ public class EntityCache<PK extends Comparable<PK>, E extends IEntity<PK>> imple
|
||||
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
|
||||
public void invalidate(PK pk) {
|
||||
// 游戏业务中,操作最频繁的是update,不是insert,delete,query
|
||||
|
||||
@@ -44,6 +44,11 @@ public interface IEntityCache<PK extends Comparable<PK>, E extends IEntity<PK>>
|
||||
*/
|
||||
void updateNow(E entity);
|
||||
|
||||
/**
|
||||
* 同updateNow(),不会校验更新的线程是否一致
|
||||
*/
|
||||
void updateUnsafeNow(E entity);
|
||||
|
||||
/**
|
||||
* 不会删除数据库中的数据,只会删除缓存数据
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user