mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-14 14:27:38 +00:00
feat[orm]: persist the entity of the specified key
This commit is contained in:
@@ -227,6 +227,15 @@ public class EntityCache<PK extends Comparable<PK>, E extends IEntity<PK>> imple
|
||||
cache.remove(pk);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void persist(PK pk) {
|
||||
var pnode = cache.get(pk);
|
||||
if (pnode == null) {
|
||||
return;
|
||||
}
|
||||
updateUnsafeNow(pnode.getEntity());
|
||||
}
|
||||
|
||||
// 游戏中80%都是执行更新的操作,这样做会极大的提高更新速度
|
||||
@Override
|
||||
public void persistAll() {
|
||||
|
||||
@@ -66,6 +66,13 @@ public interface IEntityCache<PK extends Comparable<PK>, E extends IEntity<PK>>
|
||||
*/
|
||||
void invalidate(PK pk);
|
||||
|
||||
/**
|
||||
* 持久化缓存数据
|
||||
*
|
||||
* @param pk 主键
|
||||
*/
|
||||
void persist(PK pk);
|
||||
|
||||
/**
|
||||
* 持久化所有缓存数据
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user