$retval['categories'] = $categories_result;
}
}
- if ( isset ( $prop['volatile'] ) && $frame->isVolatile() ) {
+ if ( isset( $prop['volatile'] ) && $frame->isVolatile() ) {
$retval['volatile'] = '';
}
- if ( isset ( $prop['wikitext'] ) ) {
+ if ( isset( $prop['ttl'] ) && $frame->getTTL() !== null ) {
+ $retval['ttl'] = $frame->getTTL();
+ }
+ if ( isset( $prop['wikitext'] ) ) {
$retval['wikitext'] = $wikitext;
}
}
'wikitext',
'categories',
'volatile',
+ 'ttl',
'parsetree',
),
ApiBase::PARAM_ISMULTI => true,
' wikitext - The expanded wikitext',
' categories - Any categories present in the input that are not represented in the wikitext output',
' volatile - Whether the output is volatile and should not be reused elsewhere within the page',
+ ' ttl - The maximum time after which caches of the result should be invalidated',
' parsetree - The XML parse tree of the input',
'Note that if no values are selected, the result will contain the wikitext,',
'but the output will be in a deprecated format.',
ApiBase::PROP_NULLABLE => true,
),
),
+ 'ttl' => array(
+ 'ttl' => array(
+ ApiBase::PROP_TYPE => 'integer',
+ ApiBase::PROP_NULLABLE => true,
+ ),
+ ),
'parsetree' => array(
'parsetree' => 'string',
),
*/
function isVolatile();
+ /**
+ * Get the TTL of the frame's output.
+ *
+ * This is the maximum amount of time, in seconds, that this frame's
+ * output should be cached for. A value of null indicates that no
+ * maximum has been specified.
+ *
+ * Note that this TTL only applies to caching frames as parts of pages.
+ * It is not relevant to caching the entire rendered output of a page.
+ *
+ * @return int|null
+ */
+ function getTTL();
+
+ /**
+ * Set the TTL of the output of this frame and all of its ancestors.
+ * Has no effect if the new TTL is greater than the one already set.
+ * Note that it is the caller's responsibility to change the cache
+ * expiry of the page as a whole, if such behavior is desired.
+ *
+ * @see self::getTTL()
+ * @param int $ttl
+ */
+ function setTTL( $ttl );
+
/**
* Get a title of frame
*
var $depth;
private $volatile = false;
+ private $ttl = null;
/**
* @var array
function isVolatile() {
return $this->volatile;
}
+
+ /**
+ * Set the TTL
+ *
+ * @param int $ttl
+ */
+ function setTTL( $ttl ) {
+ if ( $ttl !== null && ( $this->ttl === null || $ttl < $this->ttl ) ) {
+ $this->ttl = $ttl;
+ }
+ }
+
+ /**
+ * Get the TTL
+ *
+ * @return int|null
+ */
+ function getTTL() {
+ return $this->ttl;
+ }
}
/**
parent::setVolatile( $flag );
$this->parent->setVolatile( $flag );
}
+
+ function setTTL( $ttl ) {
+ parent::setTTL( $ttl );
+ $this->parent->setTTL( $ttl );
+ }
}
/**
var $depth;
private $volatile = false;
+ private $ttl = null;
/**
* @var array
function isVolatile() {
return $this->volatile;
}
+
+ /**
+ * Set the TTL
+ *
+ * @param int $ttl
+ */
+ function setTTL( $ttl ) {
+ if ( $ttl !== null && ( $this->ttl === null || $ttl < $this->ttl ) ) {
+ $this->ttl = $ttl;
+ }
+ }
+
+ /**
+ * Get the TTL
+ *
+ * @return int|null
+ */
+ function getTTL() {
+ return $this->ttl;
+ }
}
/**
parent::setVolatile( $flag );
$this->parent->setVolatile( $flag );
}
+
+ function setTTL( $ttl ) {
+ parent::setTTL( $ttl );
+ $this->parent->setTTL( $ttl );
+ }
}
/**