Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Performance helper class. More...
Public Member Functions | |
get_context_from_competency (competency $competency) | |
Get the context of a competency. | |
get_framework_from_competency (competency $competency) | |
Get the framework of a competency. | |
get_scale_from_competency (competency $competency) | |
Get the scale of a competency. | |
ingest_framework (competency_framework $framework) | |
Ingest a framework to avoid additional fetching. | |
Protected Attributes | |
competency_framework | $frameworks = [] |
Cache of frameworks by framework ID. | |
context | $frameworkscontexts = [] |
Cache of contexts by framework ID. | |
grade_scale[] | $scales = [] |
Cache of scales by scale ID. | |
Performance helper class.
This tool keeps a local cache of certain items, which means that subsequent calls to get the resource will not query the database. You will want to use this when many resources could be shared and need to be queried in a loop.
Note that some of these improvements can only be achieved by knowing the logic deeper in other modules. For instance we know that a competency's context is the one of its framework. This tool must be kept in sync with those APIs.
core_competency\external\performance_helper::get_context_from_competency | ( | competency | $competency | ) |
Get the context of a competency.
competency | $competency | The competency. |
context |
core_competency\external\performance_helper::get_framework_from_competency | ( | competency | $competency | ) |
Get the framework of a competency.
competency | $competency | The competency. |
competency_framework |
core_competency\external\performance_helper::get_scale_from_competency | ( | competency | $competency | ) |
Get the scale of a competency.
/!:: Make sure that this is always kept in sync with:
competency | $competency | The competency. |
grade_scale |
core_competency\external\performance_helper::ingest_framework | ( | competency_framework | $framework | ) |
Ingest a framework to avoid additional fetching.
competency_framework | $framework | The framework. |
void |