Hardening the serialization that is part of caching to database

I get "Serialize error at offset xxxx" errors when reading back caches made from the response from web APIs like the Twitter or Facebook.  I did some poking around and found blog posts like this:

* http://davidwalsh.name/php-serialize-unserialize-issues
* http://lampbear.wordpress.com/2010/06/29/serialize-error-at-offset-how-to-fix/

This patch adds the solution from these blogs and has fixed my errors.