úΤ9 o?      !"#$%&'()*+,-./0123456789:;<=>(c) 2014 Edward L. Blake BSD-style(Edward L. Blake <edwardlblake@gmail.com> experimentalportableSafe ?    ?(c) 2014 Edward L. Blake  BSD-style )Edward L. Blake <edwardlblake@gmail.com>  experimental  portable SafeUnsigned integer (@7) involved in the cache state incrementing accumulator.9Integer involved in the length of the usage history list.0Integer involved in the size of a key-value map.ÿInteger involved in the time units used to determine when an item expires. The time units used can be any arbitrary integer time representation, such as seconds or milliseconds for examples. They can also be deterministic time steps in a sequencing monad.(c) 2014 Edward L. Blake  BSD-style )Edward L. Blake <edwardlblake@gmail.com>  experimental  portable Safe'The type that encapsulates a cache map.The cache state. !"# !"# #"! !"#(c) 2014 Edward L. Blake  BSD-style )Edward L. Blake <edwardlblake@gmail.com>  experimental  portable Safe%IA cache that maintains a key access history list to perform removals of least recently used+ entries. Once the key-value map reaches 'V keys, then a list of keys to keep in the map is determined which is no larger than &S size. Entries are removed only on insertion of a new entry in the key-value map.îKey access history entries are prepended to the head of the LRU list, if an existing entry for the key appears close to the head of the list it is moved to the head of the list, instead of growing the list. When the LRU list reaches (w items, it is compacted by removing duplicate keys, by keeping only the most recent accumulator value for that key.$%&'(!"#$%&'($%&'(#"!$%&'((c) 2014 Edward L. Blake  BSD-style )Edward L. Blake <edwardlblake@gmail.com>  experimental  portable Safe,Debugging function)*AB+C,)*+,)*,+)*AB+C,(c) 2014 Edward L. Blake  BSD-style )Edward L. Blake <edwardlblake@gmail.com>  experimental  portable Safe-?Create a new expiring cache for retrieving uncached values via Dc interaction (such as in the case of reading a file from disk), with a shared state lock via an E to manage cache state.IValue request and time check request functions are provided as arguments.|The time check frequency value has to be 1 or higher, with higher values postponing time checks for longer periods of time.ˆA cache setting specifies how the cache should remove entries when the cache becomes a certain size. The only constructor for this is %..eCreate a new expiring cache along arbitrary monads with provided functions to create cache state in F) m2, and modify and read cache state in F m1.-) is just a wrapper to this function with E functions: u newECMIO retr gettime timecheckmodulo cachesettings = newECMForM retr gettime timecheckmodulo cachesettings G H I IValue request and time check request functions are provided as arguments.|The time check frequency value has to be 1 or higher, with higher values postponing time checks for longer periods of time.ˆA cache setting specifies how the cache should remove entries when the cache becomes a certain size. The only constructor for this is %./5Request a value associated with a key from the cache.iIf the value is not in the cache, the value will be requested through the function defined when the ] value was created, its computation returned and the value stored in the cache state map.FIf the value is in the cache and has not expired, it will be returned.ÚIf the value is in the cache and a new time is computed in the same lookup, and the value has been determined to have since expired, it will be discarded and a new value will be requested for this computation.Every /¥ computation increments an accumulator in the cache state which is used to keep track of the succession of key accesses. Based on the parameters provided with the %ÿ7 constructor, this history of key accesses is then used to remove entries from the cache back down to a minimum size. Also, when the modulo of the accumulator and the modulo value computes to 0, the time request function is invoked. In some cases the accumulator may get incremented more than once in a / computation.‚As the accumulator is a bound unsigned integer, when the accumulator increments back to 0, the cache state is completely cleared.GThe time request function is invoked in one of two different conditions¼When a new key-value entry is requested, the current time is also requested during the same lookup, as a recent time determination is needed for a new entry in the key-value cache.EWhen the modulo of the accumulator and a specified value equals to 0.¾When the current time is determined during a lookup, access times of the entries in the key-value cache are compared with the new time to filter out expired entries from the key-value map.1ÇInvalidates a key from the cache and returns its value if any. Note this is a sequential composition of a read and modify of the mutable cache container (readMVar and modifyMVar with newECMIO).2ÐInvalidates the entire cache and returns the last key and value if any. Note this is a sequential composition of a read and modify of the mutable cache container (readMVar and modifyMVar with newECMIO).3¤List of keys in the cache map, which can contain expired values, since the list is returned without performing a time check. keys are in an unspecified order.4ÿGList of keys in the cache map that are not expired values. A time check is always performed to compare the elapsed time and the cache state is not modified. The time check is not performed from within a modifying state context, e.g. not within modifyMVar with a newECMIO instance. Keys are in an unspecified order. 5 Used with - or .7 to provide a consistent duration for requested values. -./012345$%&'(-./012345-.5/01234$%&'( -./012345(c) 2014 Edward L. Blake  BSD-style )Edward L. Blake <edwardlblake@gmail.com>  experimental  portable Safe6?Create a new expiring cache for retrieving uncached values via Db interaction (such as in the case of reading a file from disk), with a shared state lock via an E to manage cache state.IValue request and time check request functions are provided as arguments.|The time check frequency value has to be 1 or higher, with higher values postponing time checks for longer periods of time.ˆA cache setting specifies how the cache should remove entries when the cache becomes a certain size. The only constructor for this is %.7eCreate a new expiring cache along arbitrary monads with provided functions to create cache state in F) m2, and modify and read cache state in F m1.6) is just a wrapper to this function with E functions: u newECMIO retr gettime timecheckmodulo cachesettings = newECMForM retr gettime timecheckmodulo cachesettings G H I IValue request and time check request functions are provided as arguments.|The time check frequency value has to be 1 or higher, with higher values postponing time checks for longer periods of time.ˆA cache setting specifies how the cache should remove entries when the cache becomes a certain size. The only constructor for this is %.85Request a value associated with a key from the cache.aIf the value is not in the cache, it will be requested through the function defined through newECMK, its computation returned and the value stored in the cache state map.FIf the value is in the cache and has not expired, it will be returned.ÚIf the value is in the cache and a new time is computed in the same lookup, and the value has been determined to have since expired, it will be discarded and a new value will be requested for this computation.Every 8¦ computation increments an accumulator in the cache state which is used to keep track of the succession of key accesses. Based on the parameters provided with the %ÿ6 constructor, this history of key accesses is then used to remove entries from the cache back down to a minimum size. Also, when the modulo of the accumulator and the modulo value computes to 0, the time request function is invoked. In some cases the accumulator may get incremented more than once in a 8 computation.‚As the accumulator is a bound unsigned integer, when the accumulator increments back to 0, the cache state is completely cleared.GThe time request function is invoked in one of two different conditions¼When a new key-value entry is requested, the current time is also requested during the same lookup, as a recent time determination is needed for a new entry in the key-value cache.EWhen the modulo of the accumulator and a specified value equals to 0.¾When the current time is determined during a lookup, access times of the entries in the key-value cache are compared with the new time to filter out expired entries from the key-value map.:ÇInvalidates a key from the cache and returns its value if any. Note this is a sequential composition of a read and modify of the mutable cache container (readMVar and modifyMVar with newECMIO).;ÔInvalidates a key from the cache and returns the last key and value if any. Note this is a sequential composition of a read and modify of the mutable cache container (readMVar and modifyMVar with newECMIO).<¤List of keys in the cache map, which can contain expired values, since the list is returned without performing a time check. keys are in an unspecified order.=ÿGList of keys in the cache map that are not expired values. A time check is always performed to compare the elapsed time and the cache state is not modified. The time check is not performed from within a modifying state context, e.g. not within modifyMVar with a newECMIO instance. Keys are in an unspecified order. > Used with 6 or 77 to provide a consistent duration for requested values. 6789:;<=>$%&'(6789:;<=>67>89:;<=$%&'( 6789:;<=>J        !""##$%&'()*+,-./0123456780123456789:;<=>?@AB:CD:EF:CG:HI:CJK1expiring-cache-map-0.0.6.0-ECsq6ERB4P3ALMLyzMcjnz+Caching.ExpiringCacheMap.Utils.TestSequence$Caching.ExpiringCacheMap.Utils.Types'Caching.ExpiringCacheMap.Internal.TypesCaching.ExpiringCacheMap.Types*Caching.ExpiringCacheMap.Internal.Internal Caching.ExpiringCacheMap.HashECMCaching.ExpiringCacheMap.OrdECMTestSVar TestSequenceTestSequenceStateTestSequenceEventsGetVarPutVarGetTime ReadNumber HaveNumberrunTestSequence newTestSVar enterTestSVar readTestSVargetCurrentTime readNumber haveNumber$fMonadTestSequence$fApplicativeTestSequence$fFunctorTestSequence$fShowTestSequenceState$fShowTestSequenceEvents$fEqTestSequenceEventsECMIncr ECMULength ECMMapSize TimeUnitsECM CacheState ECMReadState ECMEnterState ECMNewState CacheSettingsCacheWithLRUListmapsize removalsizecompactlistsize updateUsesdetECM detNotExpiredgetStatsStringnewECMIO newECMForM lookupECMgetValReqState invalidateinvalidateCache keysCachedkeysNotExpiredconsistentDuration putTestSVarbaseGHC.WordWord32insertAndPerhapsRemoveSomefilterExpired'detNotExpired'ghc-prim GHC.TypesIOGHC.MVarMVarGHC.BaseMonadnewMVarControl.Concurrent.MVar modifyMVarreadMVar