Evictor, a Java Concurrent Map with Timed Entry Eviction | Stoyan Rachev's Blog
I just released Evictor, a Java library providing a concurrent map that supports timed entry eviction for caching, and that is easy to use, thread-safe, very fast, and highly composable. I created it as a submission for a programming contest sponsored and organized by Cayetano Gaming and announced at the Java2Days conference, about which I already blogged. Eventually, Evictor actually won this contest, so I deem it worthy of sharing with the community.
The contest task requested simply to design a concurrent (thread-safe) map that supports timed entry eviction, having most of the standard map operations and overloaded versions of the put
and putIfAbsent
accepting one additional argument, the time-to-live in milliseconds. The criteria to judge the solutions included thread safety, performance, and design.
I started with the simple idea of providing a java.util.concurrent.ConcurrentMap
decorator, but ended up with a mini-library containing three different interfaces with multiple implementations for each one of them. I experimented with different approaches for scheduling the automated eviction and came up with several ideas, three of which seemed to perform roughly equally so I was not able to decide which one is best. Furthermore, I determined that each may deliver better performance than the other two depending on the way the map is actually used.
Read full article from Evictor, a Java Concurrent Map with Timed Entry Eviction | Stoyan Rachev's Blog
No comments:
Post a Comment