Skip to content

Commit

Permalink
fix:LruCache accessOrder 没设置为 true 的问题 (apache#600)
Browse files Browse the repository at this point in the history
fix:LruCache accessOrder 没设置为 true 的问题 (apache#600)
  • Loading branch information
qinliujie authored Sep 6, 2017
1 parent ced2e17 commit d27b45e
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.alibaba.dubbo.cache.Cache;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.utils.LRUCache;

import java.util.LinkedHashMap;
import java.util.Map;
Expand All @@ -33,14 +34,7 @@ public class LruCache implements Cache {

public LruCache(URL url) {
final int max = url.getParameter("cache.size", 1000);
this.store = new LinkedHashMap<Object, Object>() {
private static final long serialVersionUID = -3834209229668463829L;

@Override
protected boolean removeEldestEntry(Entry<Object, Object> eldest) {
return size() > max;
}
};
this.store = new LRUCache<Object,Object>(max);
}

public void put(Object key, Object value) {
Expand Down

0 comments on commit d27b45e

Please sign in to comment.