oblac / jodd

Jodd! Lightweight. Java. Zero dependencies. Use what you like.
https://jodd.org
BSD 2-Clause "Simplified" License
4.06k stars 724 forks source link

LRUCache has Concurrency problem #786

Open looly opened 2 years ago

looly commented 2 years ago

Current behavior

Hello, I found the class: LRUCache

use LinkedHashMap and use read lock for get, but the LinkedHashMap get method is not thread safe, the element will move to last of queue when get it.

image

igr commented 2 years ago

True! the thing is that the cache utilities were not migrated to the https://github.com/oblac/jodd-util.

I am under impression that there are better cache libraries out there... not sure if we should maintain this one anymore?

looly commented 2 years ago

U means that cache will be removed next time?

igr commented 2 years ago

It already is :) If you take a look in the https://github.com/oblac/jodd-util there is no cache anymore...

But I am open for discussion!

igr commented 2 years ago

So, wdyt @looly ? Would such a small cache make sense?

looly commented 2 years ago

Un.... not sense.

I mean if some user use the old version jodd-all will be touch off the bug,and its very difficut to find out it.