@main[] $sDir[outputs/160] $iStep(1) $iSleepTime(3) $iCacheTime(2) # row 1 #row 2 # wait till cache expire # row 3
Info File: 1 File: 2 File: 3 File: 4
Exec body on 1st step, then just get cached result ^do[1](3){One} ^do[2](3){Two} ^do[3](3){Three}
Value in cache not expired yet.

^do[3](3){ ^method[] }{ $exception.handled(1) ^cache(2) Error while executing body }
Wait for 3 secs. Cache expired for sure. ^sleep($iSleepTime) ^^sleep($iSleepTime)
1. Body code has an exception but force get cached result
2. Execute body and set ^^cache(0) for prevent cacheing
3. Body code has an exception, execute catch section and set ^^cache(0)
^do[1](3){ ^method[] }{ ^cache(1) $exception.handled[cache] force get cached resuls } ^do[2](3){ Two ^cache(0) } ^do[3](3){ ^method[] }{ $exception.handled(1) ^cache(0) Catch section results } ^do[4](3){ ^method[] }
@do[sFile;iSteps;jBody;jExceptionHandler][i;n;bProcessBody;bProcessErrorHandler;iTime;sBody;bError] ^for[i](1;$iSteps){ $iTime[] $bProcessBody(0) $bProcessErrorHandler(0) $nTry(0) $nCatch(0) ^try{ $sBody[^cache[$sDir/$sFile]($iCacheTime){ ^nTry.inc(1) $jBody ($i) $bProcessBody(1) $iTime(^cache[]) }{$bProcessErrorHandler(1)^nCatch.inc(1)$jExceptionHandler}] ^if($bProcessBody){ Executed body, ^^cache[] value ^if(def $iTime){defined}{undefined}, }{ ^if($bProcessErrorHandler){ Processing catch section, }{ Get cached result, } } }{ $bError(1) $exception.handled(1) } ^if($bError){ Error. Body executed $nTry times, catch executed $nCatch times. }{ result: '$sBody' } }[
] ^iStep.inc(1)