Cache

You can configure a number of different server-side caching systems for StatusNet.

Which should I use?

 * 1) If you can, use Memcache.
 * 2) If you only have one server, and don't use queues, use either APC or XCache, depending on which op-code accelerator you use.
 * 3) If you use queues, but not multiple servers, try the DiskCache.

The default implementation stores stuff in an in-memory buffer. This doesn't do much.

Memcache
If you can run Memcached, this is the one to use.

addPlugin('Memcache');

By default it expects a single memcached server running on localhost at port 11211.

Some parameters:


 * servers : array of servername:port string, like 'array('memcache1:11211', 'memcache2:11222')'
 * persistent : whether to have a persistent connection
 * compressThreshold : how big objects have to be before getting compressed. You don't need this.
 * compressMinSaving : minimum % savings needed to save compressed

We need a real live example

addPlugin('MemCache' array('servers' => 'localhost:11211'));

APC
APC is an op-code accelerator and variable cache. You can use it for caching and it has pretty decent performance. However, APC caches are per-process, so if you use queues or have multiple servers, your caches are going to get out of sync and things will get weird.

addPlugin('APC');

XCache
XCache is an op-code accelerator and variable cache. You can use it for caching and it has pretty decent performance. However, XCache caches are per-process, so if you use queues or have multiple servers, your caches are going to get out of sync and things will get weird. Also, XCache doesn't serialize inside the extension, so we have to do it in the plugin, and this seems to cost us about ~5% less performance than APC.

addPlugin('XCache');

DiskCache
You can also cache data on disk. You should be aware of the security risks -- private data like passwords and email addresses are saved in the clear in the cache, so if you've got a shared system, you should take steps to protect this dir. Overall this seems to be a pretty decent way to do things, but it also seems somewhat slower than other systems.

addPlugin('DiskCache');

Parameters:


 * root : root of the disk cache. It's a good idea to make this readable and writeable only by a user that you control. If that's not possible, it's probably a bad idea to use this plugin.