* This class stores an arbitrary value along with its dependencies.
* Users should typically only use DependencyWrapper::getFromCache(), rather
* than instantiating one of these objects directly.
+ * @addtogroup Cache
*/
class DependencyWrapper {
var $value;
$callbackParams = array(), $deps = array() )
{
$obj = $cache->get( $key );
- if ( $obj && !$obj->isExpired() ) {
+ if ( is_object( $obj ) && $obj instanceof DependencyWrapper && !$obj->isExpired() ) {
$value = $obj->value;
} elseif ( $callback ) {
$value = call_user_func_array( $callback, $callbackParams );
}
}
+/**
+ * @addtogroup Cache
+ */
abstract class CacheDependency {
/**
* Returns true if the dependency is expired, false otherwise
function loadDependencyValues() {}
}
+/**
+ * @addtogroup Cache
+ */
class FileDependency extends CacheDependency {
var $filename, $timestamp;
}
}
+/**
+ * @addtogroup Cache
+ */
class TitleDependency extends CacheDependency {
var $titleObj;
var $ns, $dbk;
}
}
+/**
+ * @addtogroup Cache
+ */
class TitleListDependency extends CacheDependency {
var $linkBatch;
var $timestamps;
# Do the query
if ( count( $timestamps ) ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$where = $this->getLinkBatch()->constructSet( 'page', $dbr );
$res = $dbr->select( 'page',
array( 'page_namespace', 'page_title', 'page_touched' ),
}
}
+/**
+ * @addtogroup Cache
+ */
class GlobalDependency extends CacheDependency {
var $name, $value;
}
}
+/**
+ * @addtogroup Cache
+ */
class ConstantDependency extends CacheDependency {
var $name, $value;
}
}
-?>
+