-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A mutable hashmap, implicitly indexed by UTCTime. -- -- A mutable hashmap, implicitly indexed by UTCTime. @package timemap @version 0.0.0 -- | A time-indexed mutable map for hashable keys. -- -- The goal of this map is to provide moderately fast lookups and -- insertions for key/value pairs, while implicitly keeping track of the -- last modification time of each entity. The auxilliary time data is -- used for filterSince and filterFromNow, which quickly -- prune the data set to get rid of old entities. module Data.TimeMap -- | A mutable reference for a time-indexed map, similar to a STRef. data TimeMap k a -- | Create a fresh, empty map. newTimeMap :: IO (TimeMap k a) -- | Inserts a key and value into a TimeMap - it adds the value or -- overwites an existing entity. insert :: (Hashable k, Eq k) => k -> a -> TimeMap k a -> IO () -- | Adjusts the value at k, while updating its time. adjust :: (Hashable k, Eq k) => (a -> a) -> k -> TimeMap k a -> IO () -- | Deletes the value at k. delete :: (Hashable k, Eq k) => k -> TimeMap k a -> IO () -- | Performs a non-mutating lookup for some key. lookup :: (Hashable k, Eq k) => k -> TimeMap k a -> IO (Maybe a) -- | Filters out all entries older than or equal to a designated time filterSince :: (Hashable k, Eq k) => UTCTime -> TimeMap k a -> IO () -- | Filters out all entries within some time frame -- --
-- filterFromNow 1 -- removes entities older than or equal to one second from now --filterFromNow :: (Hashable k, Eq k) => NominalDiffTime -> TimeMap k a -> IO ()