Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Caches data to the filesystem. More...
Public Member Functions | |
__construct ($location, $name, $type) | |
Create a new cache object. | |
__construct ($url, $timeout=10, $redirects=5, $headers=null, $useragent=null, $force_fsockopen=false, $curl_options=[]) | |
load () | |
Retrieve the data saved to the cache. | |
mtime () | |
Retrieve the last modified time for the cache. | |
save ($data) | |
Save data to the cache. | |
touch () | |
Set the last modified time to the current time. | |
unlink () | |
Remove the cache. | |
Public Attributes | |
$body | |
$error | |
$headers = [] | |
$method = SimplePie\SimplePie::FILE_SOURCE_NONE | |
$permanent_url | |
$redirects = 0 | |
$status_code = 0 | |
$success = true | |
$url | |
$useragent | |
Protected Attributes | |
string | $extension |
File extension. | |
string | $filename |
Filename. | |
string | $location |
Location string. | |
string | $name |
File path. | |
Caches data to the filesystem.
Used for fetching remote files and reading local files.
@subpackage Caching
Supports HTTP 1.0 via cURL or fsockopen, with spotty HTTP 1.1 support
This class can be overloaded with {
@subpackage HTTP
File::__construct | ( | $location, | |
$name, | |||
$type ) |
Create a new cache object.
string | $location | Location string (from SimplePie\$cache_location) |
string | $name | Unique ID for the cache |
Base\TYPE_FEED | Base\TYPE_IMAGE | $type | Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data |
File::load | ( | ) |
Retrieve the data saved to the cache.
array | Data for SimplePie\$data |
File::mtime | ( | ) |
Retrieve the last modified time for the cache.
int | Timestamp |
File::save | ( | $data | ) |
Save data to the cache.
array | SimplePie\SimplePie | $data | Data to store in the cache. If passed a SimplePie object, only cache the $data property |
bool | Successfulness |
File::touch | ( | ) |
Set the last modified time to the current time.
bool | Success status |
File::unlink | ( | ) |
Remove the cache.
bool | Success status |
|
protected |
Location string.