I’m starting out with Clojure and I’m wondering what’s the idiomatic way to write the following code snippet?
(if-let [last-time (get-last-time uid)] (when (> current-time last-time) (do-something-with-side-effect uid) (update-last-time! current-time)) (update-last-time! current-time)))
If I don’t have a ‘last time’, update the cache with current-time, if I do, but last time is newer, do something and also update the cache.
I’m bothered by the repetition of the update cache function.