同步内存中的LRU缓存映射(synchronous in-memory LRU cache map)

我在Scala中寻找一个简单的LRU缓存,它在内存中工作。 它仅用于Swing事件派发线程,所以我不想要期货,就像在Spray缓存代码中一样 。

基本上我需要一个有限大小的Map[Int, java.awt.Paint] 。

I am looking for a simple LRU cache in Scala that works in-memory. It's used only on the Swing event dispatch thread, and so I don't want futures, like in the Spray caching code.

Basically I need a Map[Int, java.awt.Paint] with a bounded size.

最满意答案

我不知道在Scala中实现了什么,但你可以使用诸如concurrentlinkedhashmap或Guava之类的Java库。

I'm not aware of something implemented in Scala, but you can use Java libraries such as concurrentlinkedhashmap or Guava.

更多推荐