|
|
| version 1.3, 2007/08/06 16:48:33 | version 1.5, 2010/07/03 07:48:30 |
|---|---|
| Line 6 $iCacheTime(2) | Line 6 $iCacheTime(2) |
| <table border="1" cellpadding="3"> | <table border="1" cellpadding="3"> |
| <tr> | <tr> |
| <th>Info</th> | |
| <th>File: 1</th> | <th>File: 1</th> |
| <th>File: 2</th> | <th>File: 2</th> |
| <th>File: 3</th> | <th>File: 3</th> |
| <th>File: 4</th> | |
| </tr> | </tr> |
| <tr> | # row 1 |
| <tr valign="top"> | |
| <td>Exec body on 1st step, then just get cached result</td> | |
| <td> | <td> |
| ^do[1](3){One} | ^do[1](3){One} |
| </td> | </td> |
| Line 21 $iCacheTime(2) | Line 25 $iCacheTime(2) |
| <td> | <td> |
| ^do[3](3){Three} | ^do[3](3){Three} |
| </td> | </td> |
| <td><br /></td> | |
| </tr> | </tr> |
| <tr> | #row 2 |
| <tr valign="top"> | |
| <td>Value in cache not expired yet.</td> | |
| <td><br /></td> | <td><br /></td> |
| <td><br /></td> | <td><br /></td> |
| <td> | <td> |
| Line 33 $iCacheTime(2) | Line 40 $iCacheTime(2) |
| }{ | }{ |
| $exception.handled(1) | $exception.handled(1) |
| ^cache(2) | ^cache(2) |
| Error occure while executing body | Error while executing body |
| } | } |
| </td> | </td> |
| </tr> | </tr> |
| # wait till cache expire | # wait till cache expire |
| <tr> | <tr valign="top"> |
| <td>Wait for 3 secs. Cache expired for sure.</td> | |
| <td colspan="3"> | <td colspan="3"> |
| ^sleep($iSleepTime) | ^sleep($iSleepTime) |
| ^^sleep($iSleepTime) | ^^sleep($iSleepTime) |
| </td> | </td> |
| <td><br /></td> | |
| </tr> | </tr> |
| <tr> | # row 3 |
| <tr valign="top"> | |
| <td> | |
| 1. Body code has an exception but force get cached result<br /> | |
| 2. Execute body and set ^^cache(0) for prevent cacheing<br /> | |
| 3. Body code has an exception, execute catch section and set ^^cache(0) | |
| </td> | |
| <td> | <td> |
| ^do[1](3){ | ^do[1](3){ |
| ^method[] | ^method[] |
| }{ | }{ |
| ^cache(1) | ^cache(1) |
| $exception.handled[cache] | $exception.handled[cache] |
| Error occure while executing body but force get cached resuls | force get cached resuls |
| } | } |
| </td> | </td> |
| Line 71 $iCacheTime(2) | Line 86 $iCacheTime(2) |
| }{ | }{ |
| $exception.handled(1) | $exception.handled(1) |
| ^cache(0) | ^cache(0) |
| Error occure while executing body | Catch section results |
| } | |
| </td> | |
| <td> | |
| ^do[4](3){ | |
| ^method[] | |
| } | } |
| </td> | </td> |
| Line 79 $iCacheTime(2) | Line 100 $iCacheTime(2) |
| </tr> | </tr> |
| </table> | </table> |
| @do[sFile;iSteps;jBody;jExceptionHandler][i;n;bProcessBody;bProcessErrorHandler;iTime;sBody;bError] | |
| @do[sFile;iSteps;jBody;jExceptionHandler][i;bProcessBody;bProcessErrorHandler;iTime;sBody] | |
| ^for[i](1;$iSteps){ | ^for[i](1;$iSteps){ |
| $iTime[] | $iTime[] |
| $bProcessBody(0) | $bProcessBody(0) |
| $bProcessErrorHandler(0) | $bProcessErrorHandler(0) |
| $sBody[^cache[$sDir/$sFile]($iCacheTime){ | $nTry(0) |
| $jBody ($i) | $nCatch(0) |
| $bProcessBody(1) | ^try{ |
| $iTime(^cache[]) | $sBody[^cache[$sDir/$sFile]($iCacheTime){ |
| }{$bProcessErrorHandler(1)$jExceptionHandler}] | ^nTry.inc(1) |
| $jBody ($i) | |
| ^if($bProcessBody){ | $bProcessBody(1) |
| Executed code, ^^cache[] value ^if(def $iTime){defined}{undefined}, | $iTime(^cache[]) |
| }{ | }{$bProcessErrorHandler(1)^nCatch.inc(1)$jExceptionHandler}] |
| ^if($bProcessErrorHandler){ | |
| Process error handler, | ^if($bProcessBody){ |
| Executed body, ^^cache[] value ^if(def $iTime){defined}{undefined}, | |
| }{ | }{ |
| Get cached result, | ^if($bProcessErrorHandler){ |
| Processing catch section, | |
| }{ | |
| Get cached result, | |
| } | |
| } | } |
| }{ | |
| $bError(1) | |
| $exception.handled(1) | |
| } | } |
| result: $sBody | ^if($bError){ |
| Error. Body executed $nTry times, catch executed $nCatch times. | |
| }{ | |
| result: '$sBody' | |
| } | |
| }[<br />] | }[<br />] |
| ^iStep.inc(1) | ^iStep.inc(1) |