1
0
Fork 0

simpler caching algorithm

* tekuti/cache.scm: Simpler LRU algorithm for the cache. Conses more,
  but throws away the cache less.
This commit is contained in:
Andy Wingo 2010-12-04 20:08:16 +01:00
parent bc53abe0b6
commit aa86b62d79

View file

@ -41,7 +41,8 @@
(apply values (assoc-ref (cdr cache) (request-uri request)))) (apply values (assoc-ref (cdr cache) (request-uri request))))
(define (cache-set cache master request . args) (define (cache-set cache master request . args)
(append (if (and cache (< (length cache) 20)) (cons* master
cache (cons (request-uri request) args)
(list master)) (if (and cache (equal? (car cache) master))
(acons (request-uri request) args '()))) (list-head (cdr cache) 9)
'())))