Add cache-files-ttl setting, and docs for the cache

main
Jordi Boggiano 12 years ago
parent b7fb60494d
commit b05a554883

@ -596,6 +596,10 @@ The following options are supported:
* **notify-on-install:** Defaults to `true`. Composer allows repositories to
define a notification URL, so that they get notified whenever a package from
that repository is installed. This option allows you to disable that behaviour.
* **cache-files-ttl:** Defaults to `15552000` (6 months). Composer caches all
dist (zip, tar, ..) packages that it downloads. Those are purged after six
months of being unused by default. This option allows you to tweak this
duration (in seconds) or disable it completely by setting it to 0.
Example:

@ -184,6 +184,8 @@ EOT
// handle config values
$uniqueConfigValues = array(
'process-timeout' => array('is_numeric', 'intval'),
'cache-ttl' => array('is_numeric', 'intval'),
'cache-files-ttl' => array('is_numeric', 'intval'),
'vendor-dir' => array('is_string', function ($val) { return $val; }),
'bin-dir' => array('is_string', function ($val) { return $val; }),
'notify-on-install' => array(

@ -120,6 +120,16 @@ class Config
return rtrim($this->process(getenv($env) ?: $this->config[$key]), '/\\');
case 'cache-ttl':
return (int) $this->config[$key];
case 'cache-files-ttl':
if (isset($this->config[$key])) {
return (int) $this->config[$key];
}
return (int) $this->config['cache-ttl'];
case 'home':
return rtrim($this->process($this->config[$key]), '/\\');

@ -240,7 +240,10 @@ class Factory
*/
public function createDownloadManager(IOInterface $io, Config $config)
{
$cache = new Cache($io, $config->get('home').'/cache.files/', 'a-z0-9_./');
$cache = null;
if ($config->get('cache-files-ttl') > 0) {
$cache = new Cache($io, $config->get('home').'/cache.files/', 'a-z0-9_./');
}
$dm = new Downloader\DownloadManager();
$dm->setDownloader('git', new Downloader\GitDownloader($io, $config));

Loading…
Cancel
Save