-- | An extreme version of the LRU strategy.
--
-- Semantically equivalent to `lruCache . finiteCache 1`, except for the `m`.
--
-- >>> withAssocCache $ withSingletonCache testC
-- one
-- two
-- one
-- two
-- testing
-- [3,3,3,3,7,7]
singletonCache :: (Monad m, Eq k) => Cache m k a -> Cache m k a
singletonCache c = c { writeCache = go }
  where
    go k mx = clearCache c >> writeCache c k mx
singletonCache :: (Monad m, Eq k) => Cache m k a -> Cache m k a
singletonCache c = c { writeCache = go }
  where
    go k mx = clearCache c >> writeCache c k mx
singletonCache c = c { writeCache = go }
  where
    go k mx = clearCache c >> writeCache c k mx