| 1 |
-- | This module contains a mutable wrapping of an LRU in the IO |
| 2 |
-- monad, providing atomic access in a concurrent environment. All |
| 3 |
-- calls preserve the same semantics as those in "Data.Cache.LRU", but |
| 4 |
-- perform updates in place. All functions use a single atomic update |
| 5 |
-- of the backing structure. |
| 6 |
-- |
| 7 |
-- The interface this module provides is opaque. If further control |
| 8 |
-- is desired, the "Data.Cache.LRU.IO.Internal" module can be used in |
| 9 |
-- combination with "Data.Cache.LRU.Internal". |
| 10 |
-- |
| 11 |
-- (This implementation uses an MVar for coarse locking. It's unclear |
| 12 |
-- if anything else would give better performance, given that many |
| 13 |
-- calls alter the head of the access list.) |
| 14 |
module Data.Cache.LRU.IO |
| 15 |
( AtomicLRU |
| 16 |
, newAtomicLRU |
| 17 |
, fromList |
| 18 |
, toList |
| 19 |
, maxSize |
| 20 |
, insert |
| 21 |
, lookup |
| 22 |
, delete |
| 23 |
, pop |
| 24 |
, size |
| 25 |
, modifyAtomicLRU |
| 26 |
, modifyAtomicLRU' |
| 27 |
) |
| 28 |
where |
| 29 |
|
| 30 |
import Prelude hiding ( lookup ) |
| 31 |
|
| 32 |
import Data.Cache.LRU.IO.Internal |