/** * Clears ALL cache associated with this object_type * For example calling this against a BBTournament, will delete * ALL cache for EVERY tournament in your database */ public function clear_object_cache() { $object_type = $this->get_cache_setting('object_type'); if (!is_null($object_type)) { $this->bb->clear_cache(null, $object_type); } }
public function test_clear_id() { //Cache a tournament, specify cache id $result = $this->object->call('Tourney.TourneyLoad.Info', array('tourney_id' => 'xQL1302101'), 2, BBCache::TYPE_TOURNAMENT, 'xQL1302101'); $this->assertServiceSuccessful($result); //cache a second tournament $result = $this->object->call('Tourney.TourneyLoad.Info', array('tourney_id' => 'xSC213021613'), 2, BBCache::TYPE_TOURNAMENT, 'xSC213021613'); $this->assertServiceSuccessful($result); //Clear cache for second tour $this->assertTrue($this->object->clear_cache(null, null, 'xSC213021613')); //Reload first - should be $result = $this->object->call('Tourney.TourneyLoad.Info', array('tourney_id' => 'xQL1302101'), 2, BBCache::TYPE_TOURNAMENT, 'xQL1302101'); $this->assertServiceLoadedFromCache($result); //Reload second - shoudl not be cached $result = $this->object->call('Tourney.TourneyLoad.Info', array('tourney_id' => 'xSC213021613'), 2, BBCache::TYPE_TOURNAMENT, 'xSC213021613'); $this->assertServiceNotLoadedFromCache($result); }
/** * Unregister / Delete a callback * * @param int $id * * @return boolean * A <b>false</b> return may indicate an invalid $id<br /> * But as always, you can refer to {@link BinaryBeast::$result_history} for details */ public function unregister($id) { $result = $this->bb->call(self::SERVICE_UNREGISTER, array('id' => $id)); //Failure! if ($result->result != BinaryBeast::RESULT_SUCCESS) { return $this->bb->set_error('Error deleting callback id "' . $id . '", check $bb->result_history for details', 'BBCallback'); } //Success - Clear all callback cache and return true $this->bb->clear_cache(null, self::CACHE_OBJECT_TYPE); return true; }