cached-json-file-0.1.1: Locally cache a json file obtained by http
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Cached.JSON

Synopsis
  • getCachedJSON :: (FromJSON a, ToJSON a) => String -> FilePath -> String -> NominalDiffTime -> IO a
  • getCachedJSONQuery :: (FromJSON a, ToJSON a) => String -> FilePath -> IO a -> NominalDiffTime -> IO a
  • lookupKey :: FromJSON a => Text -> Object -> Maybe a

Documentation

getCachedJSON Source #

Arguments

:: (FromJSON a, ToJSON a) 
=> String

subdirectory/program name

-> FilePath

filename

-> String

json url

-> NominalDiffTime

cache duration (minutes)

-> IO a 

If the local cached json file is new enough then use it, otherwise refresh from the remote url.

getCachedJSONQuery Source #

Arguments

:: (FromJSON a, ToJSON a) 
=> String

program name

-> FilePath

filename

-> IO a

http query

-> NominalDiffTime

cache duration (minutes)

-> IO a 

Similar to getCachedJSON but takes an IO procedure that fetches the remote json data.

lookupKey :: FromJSON a => Text -> Object -> Maybe a #