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