graphql-engine/server/src-lib/Hasura/Cache.hs

19 lines
519 B
Haskell
Raw Normal View History

2019-04-17 12:48:41 +03:00
module Hasura.Cache
( module Hasura.Cache.Types
, B.CacheSize(..)
, B.parseCacheSize
, initialise
2019-04-17 12:48:41 +03:00
) where
import Hasura.Prelude hiding (lookup)
2019-04-17 12:48:41 +03:00
import Hasura.Cache.Types
import qualified Hasura.Cache.Bounded as B
import qualified Hasura.Cache.Unbounded as U
2019-04-17 12:48:41 +03:00
initialise :: (Hashable k, Ord k) => Maybe B.CacheSize -> IO (Cache k v)
initialise cacheSizeM =
case cacheSizeM of
Nothing -> Cache <$> U.initialise
Just cacheSize -> Cache <$> B.initialise cacheSize