S.callOnce and S.oneShot does not work as described
Discussed on the mailing list at http://groups.google.com/group/liftweb/browse_thread/thread/aa191cc672292853#
(copied from mail)
/**
S.oneShot
this is not correct since the function is not removed until AFTER the function has completed.
The result it that oneShot can be called multiple times
/*
S.callOnce
this behaves according to the documentation as the function is removed after the invocation.
But since the method is called "callOnce" one could easily be lead to believe that it would be called only once
sbt project demonstrating the issue with the current implementation can be found at: https://github.com/teigen/call_once
(copied from mail)
/**
- All functions created inside the oneShot scope
- will only be called once and their results will be
- cached and served again if the same function is invoked
S.oneShot
this is not correct since the function is not removed until AFTER the function has completed.
The result it that oneShot can be called multiple times
/*
- If you bind functions (i.e. using SHtml helpers) inside the closure passed to callOnce,
- after your function is invoked, it will be automatically removed from functions cache so
- that it cannot be invoked again.
S.callOnce
this behaves according to the documentation as the function is removed after the invocation.
But since the method is called "callOnce" one could easily be lead to believe that it would be called only once
sbt project demonstrating the issue with the current implementation can be found at: https://github.com/teigen/call_once
Leave a comment