clojure/core.cache — pull request #2 by AndreasKostler (2012-08-03 02:54:33+00:00)
Title: Obey limit when adding element to fifo and check q count in fifo factory post condition

I think there are two issues with the FIFOCache.

1) fifo-cache-factory checks the postcondition ```clojure (= threshold (count %))``` which fails if threshold is not equal ```clojure (count base)```

2) The FIFOCache behaviour is not quite right. After removing an element (e.g. by pruning) the limit will never be reached again when inserting elements. E.g.

```clojure
clojure.core.cache> (def C (fifo-cache-factory {:a 1 :b 2} :threshold 2))
clojure.core.cache> (-> C (dissoc :a) (assoc :a 1))
{:a 1}
```