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:
parent
bc53abe0b6
commit
aa86b62d79
1 changed files with 5 additions and 4 deletions
|
@ -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)
|
||||||
|
'())))
|
||||||
|
|
Loading…
Reference in a new issue