Is it safe to use core.cache Clojure protected with ref type?

I need a card that needs to be protected from concurrent resources, type ref is suitable for my business.
Now I need a "time to live" policy to remove a potential entry that my code might forget to delete.
I checked clojure.core.cache , but I'm not sure if it is safe, since the data structure should be protected with the ref type.

I prefer a clean Clojure solution, but if things get complicated, would you suggest a different approach? For example, Google Guava?

+4
source share
1 answer

core.cache TTL implementation is immutable and does not change in place. Parallel guarantees are the requirements of the attached reference type. It should be noted, however, that caches are intended to be used in a certain way (protocol), described in the core.cache wiki .

+6
source

Source: https://habr.com/ru/post/1441336/


All Articles