[
https://issues.apache.org/jira/browse/HADOOP-13452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15507414#comment-15507414
]
Mingliang Liu commented on HADOOP-13452:
----------------------------------------
Thanks for working on this, [~fabbri].
# Is the {{LruHashMap}} always supposed to access the entries via {{mruGet()}}?
If so, I think a straight-forward approach to implementing an LRU cache is to
use the _access order_ of a LinkedHashMap. And for fixed size, we can override
the {{removeEldestEntry()}} method.
{code}
class LruCache<K, V> extends LinkedHashMap<K, V> {
private final int MAX_ENTRIES;
public LruCache(int maxEntries) {
super(maxEntries + 1, 1.0f, true);
MAX_ENTRIES = maxEntries;
}
@Override
protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
return size() > MAX_ENTRIES;
}
}
{code}
Or can we simply use the off-the-shelf
{{org.apache.commons.collections.map.LRUMap}}?
# Basically we can simply make operating methods synchronized instead of
synchronized blocks? This should improve readability if no obvious performance
loss.
# {quote}Would you rather get this v2 patch in, or wait until move()
implementation is included?{quote} I'm fine either way as well. I'm not blocked
anyway.
> S3Guard: Implement access policy for intra-client consistency with in-memory
> metadata store.
> --------------------------------------------------------------------------------------------
>
> Key: HADOOP-13452
> URL: https://issues.apache.org/jira/browse/HADOOP-13452
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: fs/s3
> Reporter: Chris Nauroth
> Assignee: Aaron Fabbri
> Attachments: HADOOP-13452.001.patch
>
>
> Implement an S3A access policy based on an in-memory metadata store. This
> can provide consistency within the same client without needing to integrate
> with an external system.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]