bug #18312 [ClassLoader] Fix storing not-found classes in APC cache (nicolas-grekas)
This PR was merged into the 2.3 branch.
Discussion
----------
[ClassLoader] Fix storing not-found classes in APC cache
| Q | A
| ------------- | ---
| Branch? | 2.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
106ed06
[ClassLoader] Fix storing not-found classes in APC cache
This commit is contained in:
commit
666dc41d0e
@ -122,8 +122,10 @@ class ApcClassLoader
|
|||||||
*/
|
*/
|
||||||
public function findFile($class)
|
public function findFile($class)
|
||||||
{
|
{
|
||||||
if (false === $file = apcu_fetch($this->prefix.$class)) {
|
$file = apcu_fetch($this->prefix.$class, $success);
|
||||||
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class));
|
|
||||||
|
if (!$success) {
|
||||||
|
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
|
@ -87,8 +87,10 @@ class ApcUniversalClassLoader extends UniversalClassLoader
|
|||||||
*/
|
*/
|
||||||
public function findFile($class)
|
public function findFile($class)
|
||||||
{
|
{
|
||||||
if (false === $file = apcu_fetch($this->prefix.$class)) {
|
$file = apcu_fetch($this->prefix.$class, $success);
|
||||||
apcu_store($this->prefix.$class, $file = parent::findFile($class));
|
|
||||||
|
if (!$success) {
|
||||||
|
apcu_store($this->prefix.$class, $file = parent::findFile($class) ?: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
|
@ -74,7 +74,7 @@ class DebugClassLoader
|
|||||||
*/
|
*/
|
||||||
public function findFile($class)
|
public function findFile($class)
|
||||||
{
|
{
|
||||||
return $this->classFinder->findFile($class);
|
return $this->classFinder->findFile($class) ?: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,8 +123,10 @@ class WinCacheClassLoader
|
|||||||
*/
|
*/
|
||||||
public function findFile($class)
|
public function findFile($class)
|
||||||
{
|
{
|
||||||
if (false === $file = wincache_ucache_get($this->prefix.$class)) {
|
$file = wincache_ucache_get($this->prefix.$class, $success);
|
||||||
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class), 0);
|
|
||||||
|
if (!$success) {
|
||||||
|
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
|
@ -126,7 +126,7 @@ class XcacheClassLoader
|
|||||||
if (xcache_isset($this->prefix.$class)) {
|
if (xcache_isset($this->prefix.$class)) {
|
||||||
$file = xcache_get($this->prefix.$class);
|
$file = xcache_get($this->prefix.$class);
|
||||||
} else {
|
} else {
|
||||||
$file = $this->decorated->findFile($class);
|
$file = $this->decorated->findFile($class) ?: null;
|
||||||
xcache_set($this->prefix.$class, $file);
|
xcache_set($this->prefix.$class, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user