Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
mod_quiz\local\override_cache Class Reference

Public Member Functions

 __construct (protected int readonly int $quizid)
 Create override_cache object and link to quiz.
 
 clear_for (?int $userid=null, ?int $groupid=null)
 Clears the cache for the given user and/or group.
 
 clear_for_group (int $groupid)
 Deletes the cached override data for a given group.
 
 clear_for_user (int $userid)
 Deletes the cached override data for the given user.
 
 get_cached_group_override (int $groupid)
 Returns the override value in the cache for the given group.
 
 get_cached_user_override (int $userid)
 Returns the override value in the cache for the given user.
 

Public Attributes

string const INVALIDATION_USERDATARESET = 'userdatareset'
 invalidation event used to purge data when reset_userdata is called, {
 

Protected Member Functions

 get_cache ()
 Returns the override cache.
 
 get_group_cache_key (int $groupid)
 Returns group cache key.
 
 get_user_cache_key (int $userid)
 Returns user cache key.
 

Constructor & Destructor Documentation

◆ __construct()

mod_quiz\local\override_cache::__construct ( protected int readonly int $quizid)

Create override_cache object and link to quiz.

Parameters
int$quizidThe quiz to link this cache to
Parameters
$quizid$quizid ID of quiz cache is being operated on *

Member Function Documentation

◆ clear_for()

mod_quiz\local\override_cache::clear_for ( ?int $userid = null,
?int $groupid = null )

Clears the cache for the given user and/or group.

Parameters
?int$useriduser to delete data for, or null.
?int$groupidgroup to delete data for, or null.

◆ clear_for_group()

mod_quiz\local\override_cache::clear_for_group ( int $groupid)

Deletes the cached override data for a given group.

Parameters
int$groupidgroup to delete data for

◆ clear_for_user()

mod_quiz\local\override_cache::clear_for_user ( int $userid)

Deletes the cached override data for the given user.

Parameters
int$useriduser to delete data for

◆ get_cache()

mod_quiz\local\override_cache::get_cache ( )
protected

Returns the override cache.

Return values
cache

◆ get_cached_group_override()

mod_quiz\local\override_cache::get_cached_group_override ( int $groupid)

Returns the override value in the cache for the given group.

Parameters
int$groupidgroup to get cached override data for
Return values
?\stdClassoverride value in the cache for the given group, or null if there is none.

◆ get_cached_user_override()

mod_quiz\local\override_cache::get_cached_user_override ( int $userid)

Returns the override value in the cache for the given user.

Parameters
int$useriduser to get cached override data for
Return values
?\stdClassthe override value in the cache for the given user, or null if there is none.

◆ get_group_cache_key()

mod_quiz\local\override_cache::get_group_cache_key ( int $groupid)
protected

Returns group cache key.

Parameters
int$groupid
Return values
stringthe group cache key

◆ get_user_cache_key()

mod_quiz\local\override_cache::get_user_cache_key ( int $userid)
protected

Returns user cache key.

Parameters
int$userid
Return values
stringthe user cache key

Member Data Documentation

◆ INVALIDATION_USERDATARESET

string const mod_quiz\local\override_cache::INVALIDATION_USERDATARESET = 'userdatareset'

invalidation event used to purge data when reset_userdata is called, {

See also
cache_helper\purge_by_event()}

The documentation for this class was generated from the following file: