You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/02/18 01:49:26 UTC

[GitHub] [iotdb] jixuan1989 commented on a change in pull request #2689: [ISSUE-2688] LRULinkedHashMap does not work as an LRU Cache

jixuan1989 commented on a change in pull request #2689:
URL: https://github.com/apache/iotdb/pull/2689#discussion_r578069241



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/cache/LRULinkedHashMap.java
##########
@@ -55,7 +55,7 @@
   protected long averageSize = 0;
 
   public LRULinkedHashMap(long maxMemory) {
-    this.linkedHashMap = new LinkedHashMap<>(INITIAL_CAPACITY, LOAD_FACTOR_MAP);

Review comment:
       Hi, 
   I am not sure whether it is enough by just enabling `accessOrder = true`.
   
   If you read the `put()` method, you will find it removes elements at the head of the set, rather than the tail...
   
   Do we need to use `removeEldestEntry ()` method instead? @JackieTien97 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org