background preloader

Wordpress memcached

Facebook Twitter

WordPress + Memcached. One of the most bizarre critiques of WordPress that I often hear is “it doesn’t come with caching” – which makes no sense because Cache is one of the best features of WordPress out of the box.

WordPress + Memcached

That’s kind of like saying: “my iPod sucks because it doesn’t have any songs in it” – when you first buy it. Your iPod can’t predict the future and come pre-loaded with songs you love, and your WordPress environment can’t come already-installed without knowing a minimal number of things. You have to pick a username / password, you have to point at a database, and if you want to cache, you have to pick how you want to cache (you don’t HAVE to cache – but really, you HAVE to cache). If you just have a blog that gets “light” traffic, and that blog only sits on one server: install W3 Total Cache (or WP Super Cache) and you can skip the rest of this post. For W3TC, make sure it is not in preview mode and follow its instructions / guidance for how to get started making your site faster.

Memcached <? <? <? <? How To Install Memcached for WordPress. A few days ago, I spoke about the architecture that powers Techie Buzz.

How To Install Memcached for WordPress

In that post, I had mentioned that memcached was one of our key ingredients. Memcache is a powerful tool to share objects across servers and it is used by several big sites including Facebook, Yahoo and many more. The best part about using memcached on your server is that you can cut down on your database queries significantly and store commonly used objects in memory and share it across multiple servers. If you use WordPress on a multi-server setup, you can easily cut down on DB queries by up-to 50% by implementing memcached. If you are interested in knowing how to implement memcached on your server, here is a tutorial. How To Install Memcached And Configure It Step 1: Install memcached using the command given below sudo apt-get install memcached Step 2: After you have installed memcached you will have to configure it through a .conf file, to do that use the command given below vi /etc/memcached.conf That’s it.

Class Reference/WP Object Cache. Class Reference/WP Object Cache Role of the WordPress Object Cache WP_Object_Cache is WordPress' class for caching data which may be computationally expensive to regenerate, such as the result of complex database queries.

Class Reference/WP Object Cache

The object cache is defined in wp-includes/cache.php. Do not use the class directly in your code when writing plugins, but use the wp_cache functions listed below. By default, the object cache is non-persistent. Use the Transients API instead of these functions if you need to guarantee that your data will be cached. Wp_cache functions Most of these functions take a: $key: the key to indicate the value. Wp_cache_add( $key, $data, $group, $expire ) This function adds data to the cache if the cache key doesn't already exist. Wp_cache_set( $key, $data, $group, $expire ) Adds data to the cache. Wp_cache_get( $key, $group ) wp_cache_get( $key, $group = '', $force = false, $found = null ) Returns the value of the cached object, or false if the cache key doesn't exist. Examples Related.