with-cache is a small package for saving the results of an expression to
the filesystem

#lang racket/base
(require pict with-cache)

(define (get-fish)
  (with-cache (cachefile "stdfish.rktd")
    (λ () (standard-fish 100 50))))

(get-fish) ;; Builds a fish
(get-fish) ;; Reads a fish from "./compiled/with-cache/stdfish.rktd"



Run the above with `racket -W info@with-cache file.rkt` to see when cache
files get written and read.

By default, cached data is serialized, written in fasl format, and
invalidated if read by a different version of the with-cache library. You
can override all these options; the docs should explain how.

Docs (latest update is yet to sync on the package server):
http://docs.racket-lang.org/with-cache/index.html

Code:
https://github.com/bennn/with-cache

History:
I started writing this code while working on a Scribble document with lots
of picts in it. (Most of the picts were made by plot. Tweaking plot
parameters led to the *current-cache-keys* parameter.)
William Bowman encouraged me to put an early version of this code on the
package server.
Leif Andersen pointed out LOTS of places where the original code needed to
improve.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to