Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core_cache\allow_temporary_caches Class Reference

Public Member Functions

 __construct ()
 Constructs an instance of this class.
 
 __destruct ()
 Destroys an instance of this class.
 

Static Public Member Functions

static is_allowed ()
 Checks if temp caches are currently allowed.
 

Static Protected Attributes

static int $references = 0
 Number of references of this class; if more than 0, temporary caches are allowed.
 

Constructor & Destructor Documentation

◆ __construct()

core_cache\allow_temporary_caches::__construct ( )

Constructs an instance of this class.

Temporary caches will be allowed until this instance goes out of scope. Store this token in a local variable, so that the caches have a limited life; do not save it outside your function.

If cache is not disabled then normal (non-temporary) caches will be used, and this class does nothing.

If an object of this class already exists then creating (or destroying) another one will have no effect.

◆ __destruct()

core_cache\allow_temporary_caches::__destruct ( )

Destroys an instance of this class.

You do not need to call this manually; PHP will call it automatically when your variable goes out of scope. If you do need to remove your token at other times, use unset($token);

If there are no other instances of this object, then all temporary caches will be discarded.

Member Function Documentation

◆ is_allowed()

static core_cache\allow_temporary_caches::is_allowed ( )
static

Checks if temp caches are currently allowed.

Return values
boolTrue if allowed

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