public static function get_record_by_contextlevel($contextlevel, $exception = true) {
        global $DB;

        $cache = \cache::make('tool_dataprivacy', 'contextlevel');
        if ($data = $cache->get($contextlevel)) {
            return new static(0, $data);
        }

        if (!$record = $DB->get_record(self::TABLE, array('contextlevel' => $contextlevel))) {
            if (!$exception) {
                return false;
            } else {
                throw new \dml_missing_record_exception(self::TABLE);
            }
        }

        return new static(0, $record);
    }
public static function get_record_by_contextlevel($contextlevel, $exception = true) {
        global $DB;

        $cache = \cache::make('tool_dataprivacy', 'contextlevel');
        if ($data = $cache->get($contextlevel)) {
            return new static(0, $data);
        }

        if (!$record = $DB->get_record(self::TABLE, array('contextlevel' => $contextlevel))) {
            if (!$exception) {
                return false;
            } else {
                throw new \dml_missing_record_exception(self::TABLE);
            }
        }

        return new static(0, $record);
    }
public static function get_record_by_contextlevel ( $ contextlevel , $ exception = true ) { global $ DB ; $ cache = \ cache :: make ( 'tool_dataprivacy' , 'contextlevel' ) ; if ( $ data = $ cache -> get ( $ contextlevel ) ) { return new static ( 0 , $ data ) ; } if ( ! $ record = $ DB -> get_record ( self :: TABLE , array ( 'contextlevel' => $ contextlevel ) ) ) { if ( ! $ exception ) { return false ; } else { throw new \ dml_missing_record_exception ( self :: TABLE ) ; } } return new static ( 0 , $ record ) ; }
Returns an instance by contextlevel.

@param mixed $contextlevel
@param mixed $exception
@return null
Returns an instance by contextlevel .