One of the things I liked on my old blog was the ability to have a Popular Posts section that was based off of Google Analytics. I had also like that I was using pre-caching, i.e., a cache that does not expire but is, rather, overwritten. There are two benefits to this. 1) There is no lag time when the cache expires and I need to contact Google to get new data. 2) If my connection goes down for whatever reason (bad data, time expired, modified password), the data stays in the cache until you can get the problem fixed.
So I had missed that, but it was not overly important so I left it. But yesterday was a day where I needed something that was both engaging and brainless to do. So I decided to implement my Job Queue API code for WordPress so that I could write a WordPress widget that would put the popular posts in the sidebar.
It was actually relatively easy to do. But the cool part was that I was able to extend WordPress, which still contains code that was written around when the Martini was invented, and PHP 5.3 code, which is what my Job Queue code was based off of. This is part of some “ESchrade enablement” which I am building as a WordPress plugin and so it contains some other stuff than just the JQ part of the plugin. You can download it from here and put it in your wp-content/plugins directory. There are some things that aren’t working quite right yet, and probably won’t. I don’t really have the desire to become a WordPress developer.
What have I learned or re-enforced from this?
- PHP backwards compatibility is pretty darn good
- If you build a software application, make building plugins easy, even if it’s your own app. (WordPress is kind of win/lose on this) I may end up looking at Event_Dispatcher.
Comments
Jeremy Cook
Sounds very cool! I very much enjoyed the chapter on job queuing in your book and it’s an area I want to look into some more. Any chance that you’ll discuss this in more depth in future blog posts?
admin
Actually, I would actually suggest taking a look at some of my other blog posts tagged “job-queue”. I started out with some very basic queuing, which is what is in the book since the copy itself is a year and a half old, but the library that I have on GitHub, which is linked in the blog post, is kind of the culmination of sporadic research into how to best use the Zend Server Job Queue.
Mike Fleisher
Interesting bit!
Amazon Web Services has a cloud-based queuing service that might be worth checking out too, if you don’t already know about it.
Thanks for the insightful posts!
Kevin Schroeder’s Blog: Added (PHP 5.3) job queuing to my WordPress instance – Me and My Self
[…] Schroeder has a quick post to his blog talking about the integration of job queuing he’s done with his WordPress blog to build a list of popular posts for his sidebar. One of […]