Add cache library
This commit is contained in:
parent
fdad470f0e
commit
45603a27bf
3 changed files with 17 additions and 11 deletions
src/lib
15
src/lib/cache.lisp
Normal file
15
src/lib/cache.lisp
Normal file
|
@ -0,0 +1,15 @@
|
|||
(defpackage #:website/lib/cache
|
||||
(:use #:cl)
|
||||
(:import-from #:function-cache
|
||||
#:defcached
|
||||
#:clear-cache)
|
||||
(:export #:memorize
|
||||
#:clear-cache))
|
||||
(in-package #:website/lib/cache)
|
||||
|
||||
(defmacro memorize (name)
|
||||
(let ((origin (gensym)))
|
||||
`(progn
|
||||
(setf (fdefinition ',origin) (fdefinition ',name))
|
||||
(defcached ,name (&rest args)
|
||||
(apply #',origin args)))))
|
Loading…
Add table
Add a link
Reference in a new issue