MyNixOS website logo
Description

Cache current time and formatted time text.

Suppose you have an IO action which runs very frequently, and one of the things it does is getting the current UTCTime, possibly also formatting it into a String or Text. The action cares about the current minute, and doesn't care about seconds or milliseconds at all. Instead of reading and formatting the time many times, using this library you can keep a cache which updates every minute (or other interval) and allows your application to scale without time reading and formatting ever becoming a bottleneck.

There are 2 modules provided. I suggest you start with the monadic one, especially for simple usage, and switch to the other one if you need some custom solution.

The Data.Time.Cache module allows you to create a time caching action which returns time and a formatted time string. But instead of directly reading the time and running a formatter, it takes the values from a cache it periodically updates.

The Control.Monad.Trans.Time module provides a convenient monadic wrapper for the time cache.

If you need the time cache in multiple threads, you can create the time getter once and then pass to all the threads to share.

See the .cabal file for more info and link to project website the version control.

The official download location is Hackage:

http://hackage.haskell.org/package/time-cache

This library is free software, and is committed to software freedom. It is released to the public domain using the CC0 Public Domain Dedication. For the boring "legal" details see the file 'COPYING'.

See the file 'INSTALL' for hints on installation. The file 'ChangeLog' explains how to see the history log of the changes done in the code. 'NEWS' provides a friendly overview of the changes for each release.

Metadata

Version

0.1

License

publicDomain

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows