19.0.0 released Nov 08, 2023
Purpose: Execute statements only once in a process.
do-once will execute <any statements> only once in a single process regardless of how many requests that process serves. <any statements> end with end-do-once. The first time a process reaches do-once, <any statements> will execute; in all subsequent cases the program control will skip to immediately after end-do-once.
do-once cannot be nested, but otherwise can be used any number of times. <any statements> execute in the same scope as the code prior and after the do-once/end-do-once.
Typical use of do-once may be a one-time setup of variables or making calls that need to be performed only once per process.
In this example, a process-scoped hash (that is available to multiple requests of a single process) is created in the very first request a process serves and data is written to it; the subsequent requests do not create a new hash but rather just write to it.
new-hash define my_hash size 1024 process-scope
write-hash my_hash key my_key value my_data
You are free to copy, redistribute and adapt this web page (even commercially), as long as you give credit and provide a dofollow link back to this page - see full license at CC-BY-4.0
. Copyright (c) 2019-2023 Dasoftver LLC. Vely and elephant logo are trademarks of Dasoftver LLC. The software and information on this web site are provided "AS IS" and without any warranties or guarantees of any kind. Icons from table-icons.io
copyright Paweł Kuna, licensed under MIT