File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
web-server-lib/web-server Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 2323 [make-cached-url->servlet
2424 (-> url->path/c
2525 path->servlet/c
26- (values (-> void)
26+ (values (() ((or/c false/c (listof url?))) . ->* . void? )
2727 url->servlet/c))])
2828
2929(define (make-cached-url->servlet
3030 url->path
3131 path->servlet)
3232 (define config:scripts (make-cache-table))
33- (values (lambda ()
33+ (values (lambda ([uris #f ] )
3434 ;; This is broken - only out of date or specifically mentioned scripts should be flushed. This destroys persistent state!
35- (cache-table-clear! config:scripts))
35+ (cache-table-clear!
36+ config:scripts
37+ (and uris
38+ (for/list ([uri (in-list uris)])
39+ (let-values ([(servlet-path _ ) (url->path uri)])
40+ (string->symbol (path->string servlet-path)))))))
3641 (lambda (uri)
3742 (define-values (servlet-path _ )
3843 (with-handlers
Original file line number Diff line number Diff line change 88 (make-cache-table (make-hasheq)
99 (make-semaphore 1 )))
1010
11- (define (cache-table-clear! ct)
11+ (define (cache-table-clear! ct [entry-ids #f ] )
1212 (call-with-semaphore
1313 (cache-table-semaphore ct)
1414 (lambda ()
15- (set-cache-table-hash! ct (make-hasheq)))))
15+ (if entry-ids
16+ (let ([cache-hash (cache-table-hash ct)])
17+ (for ([entry-id (in-list entry-ids)])
18+ (hash-remove! cache-hash entry-id)))
19+ (set-cache-table-hash! ct (make-hasheq))))))
1620
1721(define (cache-table-lookup! ct entry-id entry-thunk)
1822 (define ht (cache-table-hash ct))
3135 [rename new-cache-table make-cache-table
3236 (-> cache-table?)]
3337 [cache-table-lookup! (cache-table? symbol? (-> any/c) . -> . any/c)]
34- [cache-table-clear! (cache-table? . -> . void?)]
38+ [cache-table-clear! (( cache-table?) ((or/c false/c (listof symbol?))) . ->* . void?)]
3539 [cache-table? (any/c . -> . boolean?)])
You can’t perform that action at this time.
0 commit comments