date-cache-0.3.0: Date cacher

Safe HaskellSafe-Infered

System.Date.Cache

Contents

Description

Formatting time is slow. This package provides mechanisms to cache formatted date.

Synopsis

Types

data DateCacheConf t Source

Constructors

DateCacheConf 

Fields

getTime :: IO t

A function to get a time. E.g epochTime and getCurrentTime.

formatDate :: t -> IO ByteString

A function to format a time.

Date cacher

ondemandDateCacher :: Eq t => DateCacheConf t -> IO (DateCacheGetter, DateCacheCloser)Source

Date cacher which gets a time and formatted it only when returned getter is executed.

clockDateCacher :: Eq t => DateCacheConf t -> IO (DateCacheGetter, DateCacheCloser)Source

Date cacher which gets a time and formatted it every second. This returns a getter.