Cache Setup
getting the cache to work
The Setup
Since version 0.3 OpenTTDLib has the ability to cache data. A the moment the
cache is held in a xml file and is limited to newgrf data (grf id, md5sum, grf name).
Default Behaviour
With the default Settings:
<?php
$openttd->setOption( OpenTTDLib::OPTION_CACHE_NEWGRF, true );
$openttd->setOption( OpenTTDLib::OPTION_CACHE_FILE, 'cache.xml' );
$openttd->setOption( OpenTTDLib::OPTION_CACHE_UPDATE, true );
?>
the file cache.xml needs to be located in the directory of your OpenTTDlib copy (i.e. directory where example2.php is located)
, and the webserver needs to have read and write access to the file.
If the webserver does not have read and write access, OpenTTDLib will fail with an exception (this behavour may be changed for later releases).
If cache.xml is not present, OpenTTDLib will try to create it - giving write access to the webserver on that directory and removing cache.xml
can be helpful when troubelshooting.
Note:
1. If the webserver is not able to write to the cache file, please set OpenTTDLib::OPTION_CACHE_UPDATE to false,
to stop OpenTTDLib from trying to add new/updated data to the file.
2. If you dont want to use the cache at all, set OpenTTDLib::OPTION_CACHE_NEWGRF to false.