Dillsmack went to Italy for a bit so I am playing with code on my own. (expect downtime). Anyway I been playing with magpierss, wp-cache, and memcached and woah.
The Wu-Tang clan knew what they were talking about with C.R.E.A.M
EDIT:
Here is an example of my code for the top commentors on the side bar that I wrote and the memcache that caches in information:
[php]
function posse()
{
#start cache
$cache_key = “posse”;
$memcache = new Memcache;
$memcache->addServer(‘127.0.0.1’, 11211,0,1,1,1);
$output = $memcache->get($cache_key);
if (!$output) {
ob_start();
#end Start Cache
global $wpdb, $tablecomments;
print “
$commenters = $wpdb->get_results(“SELECT COUNT(comment_author) AS commentcount, comment_author, comment_author_url FROM $tablecomments
WHERE unix_timestamp(comment_date)>unix_timestamp(NOW())-(60*60*24*7)
AND comment_author_url !=”
AND comment_author !=’ShoeMoney’
AND comment_author != ‘ddn’
AND comment_approved = ‘1’
AND comment_type =”
GROUP BY comment_author
ORDER BY commentcount DESC
LIMIT 20;”);
foreach($commenters as $commenter)
{
print ”
“;
}
print “
“;
#End of Cache Code
$output = ob_get_contents();
$memcache->set($cache_key, $output, false, 60); // 60 second cache
ob_end_flush();
} else {
echo $output;
return;
}
#End of Cache Code
}
[/php]
So for those who understand php you can see this would be a pretty huge load for the 65,000+** hits this recieves a day… but by caching this for 60 seconds you drastically lower that 😉
Cacheing rocks!
**hits refers to total pageloads not unique visitors. This site only gets between 10,000 and 15,000 unqiues per day
Looks great. I think I’ll take a look at Wp-Cache for my own blog. Thanks for the recommends. 🙂
Since im using the wp-cache, I just can’t live without it! It makes my page faster and with the load of traffics from stumbleUpon, my blog is still on! 😀
Last RSS is a good alternative to magpie if you want something simpler.
Very interesting, i am planning on trying MagPie.
Does wp-cache require anything extra server side? I see a lot of posts on google saying they have problems installing it. I have not personally tried it myself yet, but I will bookmark this page for when I start a blog.
I also use wp-cache, and while it has issues with certain plugins with dynamic content (such as wp-postratings), it is indeed very handy to keep installed in the event of a slashdotting or getting linked from boing boing. I agree that wordpress needs to just integrate this into the main system.
nope… you just have to create a cache folder. The directions are pretty straight forward.
I use WP-Cache and didn’t even realize that there were other options. Though this plug in works very well for me, it’s nice to know that it isn’t the only plug in available.
What other plugins do you use Paul?
V
Why is Last RSS better than magpie?
Care to share the memcached code? A lot of wordpress users could benefit from this 🙂
sure I will edit the post with a example
Thanks a bunch.
C.R.E.A.M brings back memories…Wu Tang Clan is off the hook…ha ha
I stop reading at “Dillsmack went to Italy for a bit”… I’m still waiting my travel permit and I already bought $2000 in tickets to go visit my family in Italy with my wife and probably I won’t be able to go 🙁 *sigh*
So basically you’re saying.. start using wp-cache and your site will live through moderate digging??? Any wordpress site on it’s own box basically?? I think I’ll have to start learning as well :S
… “get dat money” (SHOE!) “dolla dolla bill y’alllllllllll” :p
shoe is twittering??? I’m wondering why? Do you have a custom app in the works since they opened up their platform to developers?
Yea. This is the install steps:
1. Upload the folder.
2. Click activate.
3. Done. 😛 (Unless you have some permissions you need to set)
playing with it. its entertaining… for now 😉 Maybe it will last longer then mybloglog
I lovvvve wp-cache, it’s drastically sped up my WP sites
Did Dillsmack allow you to play with code?
I installed wp-cache but it made all of my dynamic sidebar items static. Any idea what I did wrong? I’m decently tech-savvy but I admittedly didn’t look into it very far before de-activating it.
Ive been meaning to look into memcached since you talked about it last time. I guess I will give it a go
Travel Permit?
That’s pretty badass. How did you get into PHP and learn it?
I’d love to but I (kind of like you) resort to a friend for PHP help. Anyone else with ideas on how they learned?
Side note: Can you please make your logo clickable to the index page again? This is a standard usability thing
Shoe get the money dollar dollar bills yall
Shoe, is there a reason why you are using double quote marks instead of single marks in that code? I always thought single quote marks were faster.
I got in the habit of using double quotes just so I can use non literal strings. I honestly have no clue if single quotes are faster then double quotes.
Do you use a program to edit your PHP coding?
just vim
Probably not but i will see
There are a million tutorials online for PHP. Just Google “PHP Tutorials” and follow along.
If you don’t like written tutorials you can check out the videos at…
http://www.phpvideotutorials.com/
or
http://www.lynda.com/ – I think it’s about $25 per month.
I agree with Travel Notebook. The “home” button is a few inches away, but it has just become second nature for me to click on the logo to go back to the homepage. =D
Haha. Love that title. Notorious S.H.O.E
the logo is a background image, but there’s a huge gap to the left of the banner where he could put a big box with a javascript link.
and this is the best blog post title of 2007. contest over.
I had some issues with wp-cache, and I kind of am concerned about using it again because my site is updated so much I dont want my users to miss updates just because of the cache. Not sure what I can do about that..
I have Magpie running on my blog too… but not like you!
lol great Wu Tang reference
I think the version with Mary J Blige is best.
thats pretty awesome man! 🙂
dollah dollah bill y’all.
Damn now it’s stuck in my head.
You should take a look at SimplePie for that RSS Stuff
Thanks for this Shoe. You’ve inspired me to give WP-Cache and magpie a shot.
Like everyone else I can’t figure out why this isn’t included in WordPress already.
IMO, cache-ing is not justified for a website with less than 30k uniques. It does free some resources, but with nowadays servers, it takes a lot of traffic to to intimidate them. Smarty introduced such a cache-ing tool a long time ago, but I fail to see the the point of it, unless the server really can’t handle the requests. Just my opinion, I may be wrong
You are totally wrong. uniques is no measure.
Ever been dugg? I guess not. Get 150+ hits a second and let me know how that goes.
Wp-Cache is really great wordpress plugin , as u said for big sites this plugin is really mandetary.I hope wordpress fucture versions will have Wp-Cache as default plugin.
Thanks for the code, I’ve never used memcache before (my traffice levels aren’t as high as yours so never been spurred to go past wp-cache) so thanks.
wp-cache: You have the influence to get WP to add this feature. I might get a form letter response, but you could probably get them on the phone.
No one said it was better, he said it was “simpler”.
Same here, I’ll be giving memcache a go this weekend, looking forward to tracking performance results
[…] Cache Rules Everything Around Me […]
better to be over prepared and cautious than caught with your pants down and loose traffic possibilities.
Wp-Cache must be a default plugin for wordpress actually.
BTW Excellent idea you gave . I would like to try on my blog too 🙂
Me too!
Good idea 🙂 I’m using BlogEngine.net which is ASP.NET, which it has built in support for “output caching” that basically does the same thing. You can specify a timeout, and a querystring parameter used to decide whether the cache is unique (eg. if you have ?postId=x you want the cache to very with x).
I was going to mention you might get stale comments, but I see the cache is cleared every 60 seconds, not every 60 minutes. I guess that’s a good compromise 😀
This is very true… cache rules after all 🙂
[…] dank Shoemoney muss ich gerade Plugin-Entwicklern die Lektüre der Memcache-Funktionen ans Herz legen. Damit […]
[…] I came across a post from Shoemoney awhile ago in which I learned about improving WordPress performance with the wp-cache plugin. […]