File: InvalidateCacheTestOrdECM.hs

package info (click to toggle)
haskell-expiring-cache-map 0.0.6.1-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 232 kB
  • sloc: haskell: 2,209; makefile: 5
file content (27 lines) | stat: -rw-r--r-- 1,054 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{-# LANGUAGE OverloadedStrings #-}

module InvalidateCacheTestOrdECM (
    tests
) where

import Caching.ExpiringCacheMap.HashECM (newECMIO, lookupECM, CacheSettings(..), consistentDuration)
import qualified Caching.ExpiringCacheMap.HashECM as ECM (invalidateCache, keysCached, keysNotExpired)
import qualified Data.ByteString.Char8 as BS

import InvalidateCacheTestCommon (test1Common)

tests = test1

test1 = do
  filecache3 <- newECMIO
        (consistentDuration 100
          (\state id -> do BS.putStrLn "Reading a file again..."
                           return (state, ("file contents" :: BS.ByteString) )))
        (return 1)
        12000 -- Value to modulo with cache state accumulator to determine time check frequency.
        (CacheWithLRUList
          100   -- Expected size of key-value map when removing elements.
          100   -- Size at when to remove items from key-value map.
          200 )
  test1Common (lookupECM filecache3) (ECM.keysCached filecache3) (ECM.invalidateCache filecache3)
  return ()