Skip to content
Browse files

Working on nested caches

  • Loading branch information...
1 parent b705f56 commit 41182b67f3dae8b67896c0e9cc958f624afd145e @fogus fogus committed Sep 2, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/main/clojure/clojure/core/cache.clj
View
16 src/main/clojure/clojure/core/cache.clj
@@ -626,3 +626,19 @@
{:pre [(map? base)]}
(seed (SoftCache. (ConcurrentHashMap.) (ConcurrentHashMap.) (ReferenceQueue.))
base))
+
+(comment
+
+ (def C (-> {:a 1 :b 2}
+ (fifo-cache-factory :threshold 2)
+ (ttl-cache-factory :ttl 5000)))
+
+ (assoc C :c 42)
+ ;;=> {:b 2, :c 42}
+
+ ;; wait 5 seconds
+
+ (assoc C :d 138)
+ ;;=> {:d 138}
+
+)

0 comments on commit 41182b6

Please sign in to comment.
Something went wrong with that request. Please try again.