f.haeder.net

No performance improvement by memcache or redis?

I have now tried both, #memcache and #redis, to set single keys in cache. It seems both perform very poor compared to #in-progress caching.

So really no improvement if they are being used? And pipelining in redis won't help here much as I really have to "atomically" set/test/get key-value pairs.

So my in-progress cache as following seems to be the fastest:

function someCachedFooValue ($someValue) {
	if (!isset($cache[__FUNCTION__][$someValue])) {
		$cache[__FUNCTION__][$someValue] = doSomethingFooExpensive($someValue);
	}

	return $cache[__FUNCTION__][$someValue];
}


Here I want to cache the value from the expensive (long-taking) function doSomethingFooExpensive() if it is is not here.

This way seems to be the fastest way, sadly.
#memcache #redis #in-progress caching in-progress memcache performance redis
Later posts Earlier posts