speeding up heavy web apps with a php-js cache manager

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

I'm developing a CMS, with lots of javascript code.
I haven't been satisfied with my page initialization speeds, so I've
started on a caching system.

First, i used to call up javascript as needed, and just-in-time. But that,
on a localhost setup, results in a second and a half delay.
So now I include all javascript for the entire CMS as inline js in the
<head> of index.php. Index.php gets gzipped of course.
The difference is really noticeable, without looking at any counters even.

So far so good.

Now I'd like to implement a caching system for ajax requests.
I was thinking to take URL, GET, and POST send parameters, and compare such
a set to items in a local js cache.

If the local cache is not available, the ajax request is sent as normal,
and the result is put in the cache.
Javascript implementation could be as easy as changing
jQuery.ajax(ajaxCommand) to cacheManager.ajax(ajaxCommand)

If the local cache is available, the onSuccess handler of the ajax request
is called with the cached data.

On the server end, the cached items are put in a global JSON "FAT" file,
again with URL, GET and POST as keys to a flat plaintext filename.

On the server, any "normal" ajaxable URL will call php code to update the
server end cache.

Index.php would query the cache for a "subscription", a list of cache
URL+GET+POST keys, and include these cached items as
<div id="cache_idx" style="display:none"><!-- {"keys" :
{URL+GET+POST+LAST_MODIFIED}, "data" : "cached-data"} --></div>
>From where the javascript cache manager would be able to find the data.

The javascript cache manager would include some kind of polling system, to
get near realtime updates for it's cached data.

I'm convinced caching of ajax results would further increase my page
initialization speeds.

I'm interested to learn about potential pitfalls, any opensource libraries
that already do this, or any other tips you can think of.

Thanks for your time.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux