|
Moodle PHP Documentation 4.5
Moodle 4.5.5+ (Build: 20250711) (ce34e8ff087)
|
Caches data to a MySQL database. More...
Public Member Functions | |
| __construct ($location, $name, $type) | |
| Create a new cache object. | |
| apiVersion () | |
| Return the DB API version. | |
| assertExtension ($name) | |
| Load a PHP database extension if it is not loaded already. | |
| connect ($dsn, $options=false) | |
| Create a new DB object and connect to the specified database. | |
| factory ($type) | |
| Create a new DB object for the specified database type. | |
| isError ($value) | |
| Tell whether a result code from a DB method is an error. | |
| isWarning ($value) | |
| Tell whether a result code from a DB method is a warning. | |
| load () | |
| Retrieve the data saved to the cache. | |
| mtime () | |
| Retrieve the last modified time for the cache. | |
| parseDSN ($dsn) | |
| save ($data) | |
| Save data to the cache. | |
| touch () | |
| Set the last modified time to the current time. | |
| unlink () | |
| Remove the cache. | |
Public Attributes | |
| string const | TYPE_FEED = 'spc' |
| Feed cache type. | |
| string const | TYPE_IMAGE = 'spi' |
| Image cache type. | |
Static Protected Member Functions | |
| static | prepare_simplepie_object_for_cache ($data) |
| Helper for database conversion. | |
Protected Attributes | |
| string | $id |
| Cache ID. | |
| PDO | $mysql |
| PDO instance. | |
| array | $options |
| Options. | |
Caches data to a MySQL database.
Registered for URLs with the "mysql" protocol
For example, mysql://root:password@localhost:3306/mydb?prefix=sp_ will connect to the mydb database on localhost on port 3306, with the user root and the password password. All tables will be prefixed with sp_
@subpackage Caching
| MySQL::__construct | ( | $location, | |
| $name, | |||
| $type ) |
|
inherited |
Load a PHP database extension if it is not loaded already.
| $name | the base name of the extension (without the .so or .dll suffix) |
| bool | true if the extension was already or successfully loaded, false if it could not be loaded |
|
inherited |
Create a new DB object and connect to the specified database.
| $dsn | mixed "data source name", see the DB\parseDSN method for a description of the dsn format. Can also be specified as an array of the format returned by DB\parseDSN. |
| $options | mixed if boolean (or scalar), tells whether this connection should be persistent (for backends that support this). This parameter can also be an array of options, see DB_common::setOption for more information on connection options. |
|
inherited |
|
inherited |
Tell whether a result code from a DB method is an error.
| $value | int result code |
| bool | whether $value is an error |
|
inherited |
| MySQL::load | ( | ) |
| MySQL::mtime | ( | ) |
|
staticprotectedinherited |
Helper for database conversion.
Converts a given {
| SimplePie::SimplePie | $data |
| array | First item is the serialized data for storage, second item is the unique ID for this item |
| MySQL::save | ( | $data | ) |
| MySQL::touch | ( | ) |
| MySQL::unlink | ( | ) |