diff options
author | Tim Starling <tstarling@users.mediawiki.org> | 2004-10-23 10:21:23 +0000 |
---|---|---|
committer | Tim Starling <tstarling@users.mediawiki.org> | 2004-10-23 10:21:23 +0000 |
commit | d00451fa194a95aef81eaa966713950f32db43a3 (patch) | |
tree | 91f9dedbb23ec18e3a95870ea3591464dcc2eef0 /includes/ObjectCache.php | |
parent | 25b60fa1a00cc6de1a489d5d5d677860b31fe32b (diff) | |
download | mediawikicore-d00451fa194a95aef81eaa966713950f32db43a3.tar.gz mediawikicore-d00451fa194a95aef81eaa966713950f32db43a3.zip |
Fixed bug with Turck MMCache wrapper, and made it the default where Turck is installed (except if memcached is specified)
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/6014
Diffstat (limited to 'includes/ObjectCache.php')
-rw-r--r-- | includes/ObjectCache.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/includes/ObjectCache.php b/includes/ObjectCache.php index ecbf731d80a2..7e182d8d2156 100644 --- a/includes/ObjectCache.php +++ b/includes/ObjectCache.php @@ -370,16 +370,31 @@ class MediaWikiBagOStuff extends SqlBagOStuff { } /** - * @todo document + * This is a wrapper for Turck MMCache's shared memory functions. + * + * You can store objects with mmcache_put() and mmcache_get(), but Turck seems + * to use a weird custom serializer that randomly segfaults. So we wrap calls + * with serialize()/unserialize(). + * + * The thing I noticed about the Turck serialized data was that unlike ordinary + * serialize(), it contained the names of methods, and judging by the amount of + * binary data, perhaps even the bytecode of the methods themselves. It may be + * that Turck's serializer is faster, so a possible future extension would be + * to use it for arrays but not for objects. + * * @package MediaWiki */ class TurckBagOStuff extends BagOStuff { function get($key) { - return mmcache_get( $key ); + $val = mmcache_get( $key ); + if ( is_string( $val ) ) { + $val = unserialize( $val ); + } + return $val; } function set($key, $value, $exptime=0) { - mmcache_put( $key, $value, $exptime ); + mmcache_put( $key, serialize( $value ), $exptime ); return true; } |