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 15:28:39 UTC

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

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



##########
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:
       I read the `put()` method, and I think it is ok to just enable `accessOrder = true`.
   1、At line 63 of the current file, the removal of elements is realized outside of the LinkedHashMap.
   2、Everytimes after an element is accessed, the element is put at the tail, so the head is the eldest one.
   3、As the default value returned by `removeEldestEntry()` method is false, the `put()` method of LinkedHashMap does not remove any elements.




----------------------------------------------------------------
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