?      !"#$%&'()*+,-./0123456789:;<=>(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> experimentalportableSafe @     @(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> experimentalportableSafe-?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 %..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.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 / 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 / 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 conditionsWhen 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.1Invalidates a key from the cache and returns its value if any. Note that this is a sequential composition of a read and modify of the mutable cache container (e.g. I followed by H with - instances).2Invalidates the entire cache and returns the last key and value if any. Note that this is a sequential composition of a read and modify of the mutable cache container (e.g. I followed by H with - instances).3List of keys in the cache map without performing a time check, returning both stored keys that are expired and keys that are not expired. keys are in an unspecified order.4List of keys in the cache map that are not expired values. A time check is always performed to compare with the elapsed time left with each key. The cache state is not modified and the time check is not performed from within a modifying state context, e.g. not within H with a -- 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> experimentalportableSafe6?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 %.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.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 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 %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 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 conditionsWhen 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 that this is a sequential composition of a read and modify of the mutable cache container (e.g. I followed by H with 6 instances).;Invalidates the entire cache and returns the last key and value if any. Note that this is a sequential composition of a read and modify of the mutable cache container (e.g. I followed by H with 6 instances).<List of keys in the cache map without performing a time check, returning both stored keys that are expired and keys that are not expired. keys are in an unspecified order.=List of keys in the cache map that are not expired values. A time check is always performed to compare with the elapsed time left with each key. The cache state is not modified and the time check is not performed from within a modifying state context, e.g. not within H with a 6- 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:;<=>?@AB9CD9EF9CG9HI9CJK1expiring-cache-map-0.0.6.1-8DFVHCEYJw7K1T3FcUUlS2$Caching.ExpiringCacheMap.Utils.Types+Caching.ExpiringCacheMap.Utils.TestSequence'Caching.ExpiringCacheMap.Internal.TypesCaching.ExpiringCacheMap.Types*Caching.ExpiringCacheMap.Internal.InternalCaching.ExpiringCacheMap.OrdECM Caching.ExpiringCacheMap.HashECMECMIncr ECMULength ECMMapSize TimeUnitsTestSVar TestSequenceTestSequenceStateTestSequenceEventsGetVarPutVarGetTime ReadNumber HaveNumberrunTestSequence newTestSVar enterTestSVar readTestSVargetCurrentTime readNumber haveNumber$fMonadTestSequence$fApplicativeTestSequence$fFunctorTestSequence$fShowTestSequenceState$fShowTestSequenceEvents$fEqTestSequenceEventsECM CacheState ECMReadState ECMEnterState ECMNewState CacheSettingsCacheWithLRUListmapsize removalsizecompactlistsize updateUsesdetECM detNotExpiredgetStatsStringnewECMIO newECMForM lookupECMgetValReqState invalidateinvalidateCache keysCachedkeysNotExpiredconsistentDurationbaseGHC.WordWord32 putTestSVarinsertAndPerhapsRemoveSomefilterExpired'detNotExpired'ghc-prim GHC.TypesIOGHC.MVarMVarGHC.BaseMonadnewMVarControl.Concurrent.MVar modifyMVarreadMVar