Cache Blocks error "onload"
-> Explain Please

#1: Cache Blocks error "onload" Author: Aforo PostPosted: Sat Jan 03, 2009 2:25 pm
    ----
I'm working in blocks with cache for hight traffic sites and I found a interesting problem:

When I load from cache data, never I had problem until today.

Today I have a error in one block. Error was beacuse a array was "malformed". Tha error was this:

Quote::
Parse error: parse error, unexpected '"' in D:\Archivos de programa\EasyPHP 2.0b1\www\Dragon9.1\cache\Block_Temp-13_tmp.php on line 14

Error for me is not important.

I tried to avoid the error with this sentence:

Code::
if(isset($block['bid'])) { $bid=$block['bid']; } //necesary for compatibility 9.1 and 9.2 versions

$tmp = @Cache::array_load('tmp', 'Block_Temp-'.$bid, false); // Load data from "cache" directory

"@Cache::array_load" don't pass the malformed array. All the load of blocks was stoped. "@" avoit send errors, but not continues with block execution.

For me the important is not de bad data... (it was a accident)

I need than a simple data with a mistake, don't stop all the portal.

Any Idea, please?

#2: Re: Cache Blocks error "onload" Author: Aforo PostPosted: Tue Jan 20, 2009 7:03 pm
    ----
Nobody knows??? Laughing

I think that it's not possible avoid this fatal error.

But I found a nice solution for this case that minimizes pain... Confused

I wanted to use cache for my blocks and I have been succesfull in many blocks (not in "personalized" blocks, but I get some improvings also)

Now I have used cache in many of my block in:
www.google-earth.es/

Time of ejecution has drop a lot of (specially against robots) and database is now consulted only when is necessary.

I'll put you some examples of blocks with cache in the next days. Very Happy

#3: Re: Cache Blocks error "onload" Author: EestlaneLocation: Estonia PostPosted: Tue Jan 20, 2009 7:26 pm
    ----
Why was it necessary for you to allow malformed arrays?

#4: Re: Cache Blocks error "onload" Author: Aforo PostPosted: Tue Jan 20, 2009 7:37 pm
    ----
In a block with cache you write each period in cache. Ussually you haven't any problem.

But one day in Google Earth, one of the cache block failed writing an array (it was perhaps an accident because never happend again).

When a block fails with a fatal error, the program doesn't continue (stop) and you have only the html code that you have got before... this mind that if a left block fails, you don't get central content of your website or right blocks...

I found a way for minimize this posibility: testing cache file before using (loading) the array.


Last edited by Aforo on Tue Jan 20, 2009 7:44 pm; edited 1 time in total

#5: Re: Cache Blocks error "onload" Author: EestlaneLocation: Estonia PostPosted: Tue Jan 20, 2009 7:41 pm
    ----
I think I understand, thanks for sharing.



-> Explain Please

All times are GMT

Page 1 of 1