[Bese-devel] isolated actions
drewc at tech.coop
Wed Apr 5 05:19:22 UTC 2006
Evrim ULU wrote:
> where do we use isolated actions in practice?
Isolated actions! doh! (they don't work in ucw for a while now and i
forgot to send the patch (attached)).
:isolate should be used when you only want an action to fire once, even
if the same link is clicked or the page reloaded.
For example, if i have an 'charge-credit-card' action, i would not want
a reload of the page or a 'back-button, click same link' to charge the
card _again_ (well, i wouldn't mind, but the customer might be pissed).
:ISOLATE memoizes the action body so that it will only run once,
regardless of how many times the same URL is hit.
The attached patch is against a slightly older ucw_dev. If it no longer
applies cleanly, the replacement code for DEFACTION follows (and
RUN-ISOLATED can be removed from standard-component.lisp).
(defmacro defaction (name &rest rest)
(if (equal (car rest) :isolate)
(with-unique-names (memo-id memo memo-present-p)
`(defaction ,name ,(second rest)
(strcat (mapcar (rcurry #'funcall *context*)
(multiple-value-bind (,memo ,memo-present-p)
(gethash ,memo-id (component.isolate-hash ,(caar (second
(setf (gethash ,memo-id (component.isolate-hash ,(caar
(progn ,@ (cddr rest))))))))
`(%defaction ,name , at rest)))
> king regards,
> bese-devel mailing list
> bese-devel at common-lisp.net
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the bese-devel