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))))
(define (cache-set cache master request . args)
(append (if (and cache (< (length cache) 20))
cache
(list master))
(acons (request-uri request) args '())))
(cons* master
(cons (request-uri request) args)
(if (and cache (equal? (car cache) master))
(list-head (cdr cache) 9)
'())))