I added that in the mainfile directly above the code as described and It hosed the whole site.
Code:
Warning: main(/includes/Cache_Lite/Lite.php): failed to open stream: No such file or directory in /var/www/html/mainfile.php on line 23
Fatal error: main(): Failed opening required '/includes/Cache_Lite/Lite.php' (include_path='.:/php/includes:/usr/share/php') in /var/www/html/mainfile.php on line 23
And the file is there and functioning i use it on all the blocks.
Joined: Feb 22, 2004 Posts: 40 Location: Dorset, England
Posted:
Mon Feb 23, 2004 7:16 am
Hi,
All working now It was the missing define ('NUKER',1); that seemed to be stopping it from working.
I've since added the cache code to my scrolling downloads and weblinks blocks, is it worth adding it to blocks that don't change like the modules and donations block?
Anyway, thanks for all your help and hard work, I had tried using JPCache but didn't like the way it worked as when viewing a cached page you would quite often appear to be logged in as someone else
Glad it worked. Ok, now moved define('NUKER.. line away from mainfile code to near the top of your root's index.php. That would be ncesssary otherwise when you go into forum admin, you will get an error.
In hindsight, I should have provided better instructions.
Joined: Feb 22, 2004 Posts: 40 Location: Dorset, England
Posted:
Wed Feb 25, 2004 12:50 pm
Hi,
I moved that line straight after I got it all working, I've since gone on to cache most of the blocks and have page generation down to a reasonable time, combined with getting Gzip working it's like I now have a diferent site
Quote:
mine is always DeepBlue, so I hard-coded the function to just always return that.... i.e. I put return("DeepBlue") as the first line in the function. If you allow your users to change themes, your situation would be different (most sites don't, I believe).
I only use one theme, is it just a case of removing all but the line return ("theme") from the get theme function?
Is that what you meant about not replacing the other two lines? Above code gives an error on line 128 which is...
Code:
if ($CacheData = $Cache_Lite->get($_SERVER['SERVER_NAME'] . 'stats')) { //make it unique to each webserver address, to not interfere
My cache *appears* to be fine. Files appear in the /includes/Cache_Lite/temp/ directory andare never older than ten minutes so I'm assuming that's ok. I still think it's something stupid I've done! lol
Notice the new instance of cache is called $Cache_LiteNEW. Now fix the code you just changed to also say $Cache_LiteNEW wherever you find $Cache_Lite. So in summary, we are initializing cachelite just before caching the user stuff. See if this works. If it works, just leave it.
Joined: Feb 22, 2004 Posts: 40 Location: Dorset, England
Posted:
Thu Feb 26, 2004 11:07 am
Hi,
That seems to have sorted it out Any idea why the cache would not be initializing properly using your original code? Just sems a bit weird (I still think I messed it up!)
good. I don't know why since I don't have this problem. You can test if your old cache was initialized just before your user code snippet by putting in something like this:
Code:
if (isset($Cache_Lite)) {
echo "cache is good<br>";
}
else {
echo "cache is bad<br>";
}
***also, you may consider using another temp directory for this new cache. I don't know how well written is the Lite code, but we want to avoid any claches between the files of the two cache objects (just in case)
I'd like you to run some benchmarks on your own site. Repeatedly call your home page, for instance, as it is now written. Maybe 10 times and record the build times. Then, replace the 4 functions with these and run the same test, discarding the first one because if you are using an optimizer, it will recache it the first time when it detects a change.
Here are my results. Allowing for network traffic that I can't control:
There seems a marginal gain in page loading speed but there are too many variables at work on the Internet for me to be sure. Anyway, I'm happy to contribute to scientific progress!
Joined: Sep 17, 2003 Posts: 31 Location: Australia
Posted:
Fri Mar 12, 2004 12:07 am
Quote:
Raven wrote:
I'd like you to run some benchmarks on your own site. Repeatedly call your home page, for instance, as it is now written. Maybe 10 times and record the build times. Then, replace the 4 functions with these and run the same test, discarding the first one because if you are using an optimizer, it will recache it the first time when it detects a change.
Ok, I applied these 4 functions to my very modified site, and also added cache-lite to the blocks, just for information, here are my before and after times for a large index page:
Before any changes:
Page Generation: 6.831 Seconds. - 124 pages served in past 5 minutes.
Page Generation: 3.323 Seconds. - 126 pages served in past 5 minutes.
Page Generation: 3.450 Seconds. - 116 pages served in past 5 minutes.
Page Generation: 2.530 Seconds. - 117 pages served in past 5 minutes.
Page Generation: 6.028 Seconds. - 129 pages served in past 5 minutes.
Page Generation: 7.652 Seconds. - 116 pages served in past 5 minutes.
Page Generation: 4.713 Seconds. - 121 pages served in past 5 minutes.
Page Generation: 3.680 Seconds. - 119 pages served in past 5 minutes.
Page Generation: 4.410 Seconds. - 115 pages served in past 5 minutes.
Page Generation: 6.593 Seconds. - 121 pages served in past 5 minutes.
and after:
Page Generation: 1.216 Seconds. - 165 pages served in past 5 minutes.
Page Generation: 1.083 Seconds. - 164 pages served in past 5 minutes.
Page Generation: 2.718 Seconds. - 166 pages served in past 5 minutes.
Page Generation: 2.553 Seconds. - 167 pages served in past 5 minutes.
Page Generation: 0.926 Seconds. - 175 pages served in past 5 minutes.
Page Generation: 1.674 Seconds. - 174 pages served in past 5 minutes.
Page Generation: 0.862 Seconds. - 177 pages served in past 5 minutes.
Page Generation: 3.380 Seconds. - 171 pages served in past 5 minutes.
Page Generation: 1.181 Seconds. - 171 pages served in past 5 minutes.
Page Generation: 1.068 Seconds. - 151 pages served in past 5 minutes.
I would say it is quite an improvement. I have 7 blocks cached, and ranging in intevals from 1 minute to 2 1/2 hours, depending on the blocks content. (I did not cache the site-visitors block at all either) I have not done the forum changes for cache lite as yet, as they seem to be fine with just the blocks done (av. of 0.4 seconds).
Hi, Mick
I would say that is a nice improvement I think even more can be gained by using mmcache, which is in-memory cache (cachelite is disk based) and which also caches php code.
My dev environment is Windows, and it does not seem that easy to install mmcache, but I am trying. If anyone figures that out, let me know.
Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
Posted:
Fri Mar 12, 2004 12:25 am
Great! I had a problem with the Cache Lite and had to remove it until I get time to figure it out. In my site navigation block, after an hour or so, the admin modules would no longer show. Strangest thing.
Joined: Sep 17, 2003 Posts: 31 Location: Australia
Posted:
Fri Mar 12, 2004 12:34 am
Raven wrote:
Great! I had a problem with the Cache Lite and had to remove it until I get time to figure it out. In my site navigation block, after an hour or so, the admin modules would no longer show. Strangest thing.
Yes, it has taken me about 2 days to get cache-lite to work, but finally did, and it was as simple of changing a few permissions and ownerships here and there (but nothing that should affect security I am hoping)
I use the sommaire block for the menu, but also modified this a lot to my liking as well, and it only shows the admin invis/inactive modules when I am in the admin section, and it is only also visible to myself, all other admins do not see it (yet another hack, due to the way I have the site set up for admins, long story!), other than that, have not found a problem, except when i tested it on the site visitors/info block, and it cached other members details , so I removed it from that block.
I have looked at mmcache, but thought it was above my level of competancy and i would more likely break something
Anyways, thanks to all who worked on this, it is great.
EDIT:
hmmm, I see what you mean, overnight my invis and inactive modules disappeared as well, but i guess it is due to the caching. I will overcome this by making a new block just for these tho, visible only to superadmins.
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum