Don't use public-audience-only function
[lhc/web/wiklou.git] / includes / ObjectCache.php
index 2e0fedc..07525ac 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 /**
- * @addtogroup Cache
+ * @file
+ * @ingroup Cache
  */
 
 /**
@@ -8,7 +9,7 @@
  * It acts as a memcached server with no RAM, that is, all objects are
  * cleared the moment they are set. All set operations succeed and all
  * get operations return null.
- * @addtogroup Cache
+ * @ingroup Cache
  */
 class FakeMemCachedClient {
        function add ($key, $val, $exp = 0) { return true; }
@@ -47,23 +48,21 @@ function &wfGetCache( $inputType ) {
        }
 
        if ( $type == CACHE_MEMCACHED ) {
-               if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ){
+               if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ) {
                        require_once( 'memcached-client.php' );
-
-                       if (!class_exists("MemcachedClientforWiki")) {
+                       if ( !class_exists("MemcachedClientforWiki") ) {
                                class MemCachedClientforWiki extends memcached {
                                        function _debugprint( $text ) {
                                                wfDebug( "memcached: $text" );
                                        }
                                }
                        }
-
-                       $wgCaches[CACHE_DB] = new MemCachedClientforWiki(
+                       $wgCaches[CACHE_MEMCACHED] = new MemCachedClientforWiki(
                                array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) );
-                       $cache =& $wgCaches[CACHE_DB];
-                       $cache->set_servers( $wgMemCachedServers );
-                       $cache->set_debug( $wgMemCachedDebug );
+                       $wgCaches[CACHE_MEMCACHED]->set_servers( $wgMemCachedServers );
+                       $wgCaches[CACHE_MEMCACHED]->set_debug( $wgMemCachedDebug );
                }
+               $cache =& $wgCaches[CACHE_MEMCACHED];
        } elseif ( $type == CACHE_ACCEL ) {
                if ( !array_key_exists( CACHE_ACCEL, $wgCaches ) ) {
                        if ( function_exists( 'eaccelerator_get' ) ) {
@@ -87,7 +86,7 @@ function &wfGetCache( $inputType ) {
                }
                $cache =& $wgCaches[CACHE_DBA];
        }
-       
+
        if ( $type == CACHE_DB || ( $inputType == CACHE_ANYTHING && $cache === false ) ) {
                if ( !array_key_exists( CACHE_DB, $wgCaches ) ) {
                        $wgCaches[CACHE_DB] = new MediaWikiBagOStuff('objectcache');
@@ -122,5 +121,3 @@ function &wfGetParserCacheStorage() {
        $ret =& wfGetCache( $wgParserCacheType );
        return $ret;
 }
-
-