úΈ`…?0      !"#$%&'()*+,-./(c) 2014 Edward L. Blake  BSD-style )Edward L. Blake <edwardlblake@gmail.com>  experimental  portable  Safe-Inferred 0123     0123(c) 2014 Edward L. Blake  BSD-style )Edward L. Blake <edwardlblake@gmail.com>  experimental  portable  Safe-InferredUnsigned integer (48) involved in the cache state incrementing accumulator. :Integer involved in the length of the usage history list. 1Integer 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-Inferred(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-InferredJA cache that maintains a key access history list to perform removals of least recently used, entries. Once the key-value map reaches !W keys, then a list of keys to keep in the map is determined which is no larger than  U 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 "z 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-Inferred%Debugging function #$56%#$%#$%#$56%(c) 2014 Edward L. Blake  BSD-style )Edward L. Blake <edwardlblake@gmail.com>  experimental  portable None&?Create a new expiring cache for retrieving uncached values via 7e interaction (such as in the case of reading a file from disk), with a shared state lock via an 8 to manage cache state. JValue 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 . 'fCreate a new expiring cache along arbitrary monads with provided functions to create cache state in 9* m2, and modify and read cache state in 9 m1. &) is just a wrapper to this function with 8 functions:  w newECMIO retr gettime timecheckmodulo cachesettings = newECMForM retr gettime timecheckmodulo cachesettings : ; < JValue 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 . (6Request a value associated with a key from the cache. jIf 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. GIf 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 ÿ; 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. HThe 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. FWhen 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. * Used with & or '8 to provide a consistent duration for requested values. &'()*  !"&'()* &'*() !"&'()*(c) 2014 Edward L. Blake  BSD-style )Edward L. Blake <edwardlblake@gmail.com>  experimental  portable  Safe-Inferred+?Create a new expiring cache for retrieving uncached values via 7d interaction (such as in the case of reading a file from disk), with a shared state lock via an 8 to manage cache state. JValue 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 . ,fCreate a new expiring cache along arbitrary monads with provided functions to create cache state in 9* m2, and modify and read cache state in 9 m1. +) is just a wrapper to this function with 8 functions:  w newECMIO retr gettime timecheckmodulo cachesettings = newECMForM retr gettime timecheckmodulo cachesettings : ; < JValue 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 . -6Request a value associated with a key from the cache. bIf the value is not in the cache, it will be requested through the function defined through newECMM, its computation returned and the value stored in the cache state map. GIf 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 ÿ: 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. HThe 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. FWhen 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. / Used with + or ,8 to provide a consistent duration for requested values. +,-./  !"+,-./ +,/-. !"+,-./=        !"#$%&'()*+,-)*+,-./01234567892:;2<=2:>2?@2:ABexpiring-cache-map-0.0.5.3+Caching.ExpiringCacheMap.Utils.TestSequence$Caching.ExpiringCacheMap.Utils.Types'Caching.ExpiringCacheMap.Internal.TypesCaching.ExpiringCacheMap.Types*Caching.ExpiringCacheMap.Internal.Internal Caching.ExpiringCacheMap.HashECMCaching.ExpiringCacheMap.OrdECMTestSVar TestSequenceTestSequenceStateTestSequenceEvents HaveNumber ReadNumberGetTimePutVarGetVarrunTestSequence newTestSVar enterTestSVar readTestSVargetCurrentTime readNumber haveNumberECMIncr ECMULength ECMMapSize TimeUnitsECM CacheState ECMReadState ECMEnterState ECMNewState CacheSettingsCacheWithLRUListmapsize removalsizecompactlistsize updateUsesdetECMgetStatsStringnewECMIO newECMForM lookupECMgetValReqStateconsistentDuration putTestSVar$fMonadTestSequence$fShowTestSequenceState$fShowTestSequenceEventsbaseGHC.WordWord32insertAndPerhapsRemoveSomefilterExpired'ghc-prim GHC.TypesIOGHC.MVarMVarGHC.BaseMonadnewMVarControl.Concurrent.MVar modifyMVarreadMVar