diff options
author | Andy Wingo | 2010-12-04 20:08:16 +0100 |
---|---|---|
committer | Andy Wingo | 2010-12-04 20:08:16 +0100 |
commit | aa86b62d7907f75d956d9bcf988c986c0cec231c (patch) | |
tree | 65fad97bb25ecd1c13cb14f4d9298682a52632d9 | |
parent | bc53abe0b6fd969906f371735a34a17ef5b6de70 (diff) | |
download | tekuti-aa86b62d7907f75d956d9bcf988c986c0cec231c.tar.gz tekuti-aa86b62d7907f75d956d9bcf988c986c0cec231c.zip |
simpler caching algorithm
* tekuti/cache.scm: Simpler LRU algorithm for the cache. Conses more,
but throws away the cache less.
-rw-r--r-- | tekuti/cache.scm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tekuti/cache.scm b/tekuti/cache.scm index abb1841..73228e0 100644 --- a/tekuti/cache.scm +++ b/tekuti/cache.scm @@ -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) + '()))) |