1
0
Fork 0

Update Indexer.php

pull/624/head
Xiaohui Lam 2018-11-12 02:08:19 +08:00 committed by GitHub
parent fb75ec49bd
commit bae4f35744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -152,12 +152,16 @@ class Indexer
// Dynamic constraints are not cached, because they can change every time // Dynamic constraints are not cached, because they can change every time
$packageVersion = ltrim($package->version, 'v'); $packageVersion = ltrim($package->version, 'v');
if ($package->name === $packageName) { if ($package->name === $packageName) {
$packageKey = $packageName . ':' . $packageVersion;
if (strpos($packageVersion, 'dev') !== false) { if (strpos($packageVersion, 'dev') !== false) {
$packageKey = $packageName . ':' . (isset($package->source) && isset($package->source->reference) ? if (isset($package->source) && isset($package->source->reference)) {
$package->source->reference : (isset($package->dist) && isset($package->dist->reference) ? $packageVersion = $package->source->reference;
$package->source->reference : $packageVersion)); } else {
if (isset($package->dist) && isset($package->dist->reference)) {
$packageVersion = $package->source->reference;
}
}
} }
$packageKey = $packageName . ':' . $packageVersion;
$cacheKey = self::CACHE_VERSION . ':' . $packageKey; $cacheKey = self::CACHE_VERSION . ':' . $packageKey;
// Check cache // Check cache
$index = yield $this->cache->get($cacheKey); $index = yield $this->cache->get($cacheKey);