|
|
@ -19,15 +19,7 @@
|
|
|
|
(define (cache-has-key? path)
|
|
|
|
(define (cache-has-key? path)
|
|
|
|
(hash-has-key? (current-cache) path))
|
|
|
|
(hash-has-key? (current-cache) path))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (cache path)
|
|
|
|
(define (cached-require path-string key)
|
|
|
|
|
|
|
|
(when (not (current-cache)) (error "cached-require: No cache set up."))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define path
|
|
|
|
|
|
|
|
(with-handlers ([exn:fail? (λ(exn) (displayln (format "cached-require: ~a is not a valid path" path-string)))])
|
|
|
|
|
|
|
|
(->complete-path path-string)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (cache path)
|
|
|
|
|
|
|
|
(dynamic-rerequire path)
|
|
|
|
(dynamic-rerequire path)
|
|
|
|
(hash-set! (current-cache) path (make-hash))
|
|
|
|
(hash-set! (current-cache) path (make-hash))
|
|
|
|
(define cache-hash (cache-ref path))
|
|
|
|
(define cache-hash (cache-ref path))
|
|
|
@ -36,6 +28,14 @@
|
|
|
|
(hash-set! cache-hash 'metas (dynamic-require path 'metas))
|
|
|
|
(hash-set! cache-hash 'metas (dynamic-require path 'metas))
|
|
|
|
(void))
|
|
|
|
(void))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (cached-require path-string key)
|
|
|
|
|
|
|
|
(when (not (current-cache)) (error "cached-require: No cache set up."))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define path
|
|
|
|
|
|
|
|
(with-handlers ([exn:fail? (λ(exn) (displayln (format "cached-require: ~a is not a valid path" path-string)))])
|
|
|
|
|
|
|
|
(->complete-path path-string)))
|
|
|
|
|
|
|
|
|
|
|
|
(when (or (not (cache-has-key? path))
|
|
|
|
(when (or (not (cache-has-key? path))
|
|
|
|
(> (file-or-directory-modify-seconds path) (hash-ref (cache-ref path) 'mod-time)))
|
|
|
|
(> (file-or-directory-modify-seconds path) (hash-ref (cache-ref path) 'mod-time)))
|
|
|
|
(cache path))
|
|
|
|
(cache path))
|
|
|
|