--- parser3/tests/160.html 2007/08/06 16:48:33 1.3
+++ parser3/tests/160.html 2008/01/28 16:17:42 1.4
@@ -6,12 +6,16 @@ $iCacheTime(2)
+| Info |
File: 1 |
File: 2 |
File: 3 |
+File: 4 |
-
+# row 1
+
+| Exec body on 1st step, then just get cached result |
^do[1](3){One}
|
@@ -21,10 +25,13 @@ $iCacheTime(2)
^do[3](3){Three}
|
+
|
-
+#row 2
+
+| Value in cache not expired yet. |
|
|
@@ -33,28 +40,36 @@ $iCacheTime(2)
}{
$exception.handled(1)
^cache(2)
- Error occure while executing body
+ Error while executing body
}
|
# wait till cache expire
-
+
+| Wait for 3 secs. Cache expired for sure. |
^sleep($iSleepTime)
^^sleep($iSleepTime)
|
+
|
-
+# row 3
+
+
+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]
- Error occure while executing body but force get cached resuls
+ force get cached resuls
}
|
@@ -71,7 +86,13 @@ $iCacheTime(2)
}{
$exception.handled(1)
^cache(0)
- Error occure while executing body
+ Catch section results
+}
+
+
+
+^do[4](3){
+ ^method[]
}
|
@@ -80,29 +101,41 @@ $iCacheTime(2)
-@do[sFile;iSteps;jBody;jExceptionHandler][i;bProcessBody;bProcessErrorHandler;iTime;sBody]
+@do[sFile;iSteps;jBody;jExceptionHandler][i;n;bProcessBody;bProcessErrorHandler;iTime;sBody;bError]
^for[i](1;$iSteps){
$iTime[]
$bProcessBody(0)
$bProcessErrorHandler(0)
-
- $sBody[^cache[$sDir/$sFile]($iCacheTime){
- $jBody ($i)
- $bProcessBody(1)
- $iTime(^cache[])
- }{$bProcessErrorHandler(1)$jExceptionHandler}]
-
- ^if($bProcessBody){
- Executed code, ^^cache[] value ^if(def $iTime){defined}{undefined},
- }{
- ^if($bProcessErrorHandler){
- Process error handler,
+
+ $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},
}{
- 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'
+ }
}[