EntityCache优化

This commit is contained in:
redkale
2023-03-29 21:34:55 +08:00
parent df0a290032
commit ee535692b4

View File

@@ -807,6 +807,7 @@ public final class EntityCache<T> {
T old = this.map.putIfAbsent(this.primary.get(rs), rs);
if (old == null) {
this.list.add(rs);
this.array = transferArray(new ArrayList<>(this.list));
return 1;
} else {
logger.log(Level.WARNING, this.type + " cache repeat insert data: " + entity);
@@ -823,6 +824,7 @@ public final class EntityCache<T> {
return 0;
}
this.list.remove(rs);
this.array[(Integer) primary.get(rs)] = null;
return 1;
}
@@ -849,6 +851,7 @@ public final class EntityCache<T> {
ids[++i] = this.primary.get(t);
this.map.remove(ids[i]);
this.list.remove(t);
this.array[(Integer) primary.get(t)] = null;
}
return ids;
}