time-cache: Cache current time and formatted time text

[ library, public-domain, system, time ] [ Propose Tags ] [ Report a vulnerability ]

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.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1
Change log ChangeLog
Dependencies auto-update (>=0.1.3), base (>=4.8 && <5), text (>=1.2.2.0), time (>=1.5.0.1), time-units (>=1.0.0), transformers (>=0.4.2.0) [details]
License LicenseRef-PublicDomain
Copyright ♡ Copying is an act of love. Please copy, reuse and share.
Author fr33domlover
Maintainer fr33domlover@riseup.net
Category System, Time
Home page http://rel4tion.org/projects/time-cache
Bug tracker mailto:fr33domlover@riseup.net
Source repo head: darcs get http://hub.darcs.net/fr33domlover/time-cache
Uploaded by akrasner at 2016-03-15T20:53:07Z
Distributions NixOS:0.1
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 872 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-11-27 [all 1 reports]

Readme for time-cache-0.1

[back to package description]

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.