+ # Load the blocks from the database and save them to memcached
+ function loadFromDB() {
+ global $wgUseMemCached, $wgMemc;
+ $this->mData = array();
+ # Selecting FOR UPDATE is a convenient way to serialise the memcached and DB operations,
+ # which is necessary even though we don't update the DB
+ if ( $wgUseMemCached ) {
+ Block::enumBlocks( 'wfBlockCacheInsert', '', EB_FOR_UPDATE );
+ $wgMemc->set( $this->mMemcKey, $this->mData, 0 );
+ } else {
+ Block::enumBlocks( 'wfBlockCacheInsert', '' );
+ }
+ }
+
+ # Load the cache from memcached or, if that's not possible, from the DB
+ function load() {