--- parser3/tests/160.html 2007/03/27 08:38:34 1.1 +++ parser3/tests/160.html 2010/07/03 07:48:30 1.5 @@ -1,26 +1,139 @@ @main[] -^do[One] -^sleep(1) -^do[Two] +$sDir[outputs/160] +$iStep(1) +$iSleepTime(3) +$iCacheTime(2) + + + + + + + + +# row 1 + + + + + + + -@do[sText][i] -
-^for[i](1;3){ - $iCacheTime[] - ^cache[outputs/160.cache](1){ - =$sText= - ^if($sText eq "Two"){ - ^cache(0) + +#row 2 + + + + + + + +# wait till cache expire + + + + + + + +# row 3 + + + + + + + + + + + + +
InfoFile: 1File: 2File: 3File: 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, + } } - $iCacheTime(^cache[]) + }{ + $bError(1) + $exception.handled(1) } - ^if(def $iCacheTime){ - Execute code, ^^cache[] == ^iCacheTime.int(0) + + ^if($bError){ + Error. Body executed $nTry times, catch executed $nCatch times. }{ - Get cached result + result: '$sBody' } -
-} - +}[
] +^iStep.inc(1)