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)
|
||||
{
|
||||
if (false === $file = apcu_fetch($this->prefix.$class)) {
|
||||
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class));
|
||||
$file = apcu_fetch($this->prefix.$class, $success);
|
||||
|
||||
if (!$success) {
|
||||
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null);
|
||||
}
|
||||
|
||||
return $file;
|
||||
|
@ -87,8 +87,10 @@ class ApcUniversalClassLoader extends UniversalClassLoader
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
if (false === $file = apcu_fetch($this->prefix.$class)) {
|
||||
apcu_store($this->prefix.$class, $file = parent::findFile($class));
|
||||
$file = apcu_fetch($this->prefix.$class, $success);
|
||||
|
||||
if (!$success) {
|
||||
apcu_store($this->prefix.$class, $file = parent::findFile($class) ?: null);
|
||||
}
|
||||
|
||||
return $file;
|
||||
|
@ -74,7 +74,7 @@ class DebugClassLoader
|
||||
*/
|
||||
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)
|
||||
{
|
||||
if (false === $file = wincache_ucache_get($this->prefix.$class)) {
|
||||
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class), 0);
|
||||
$file = wincache_ucache_get($this->prefix.$class, $success);
|
||||
|
||||
if (!$success) {
|
||||
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null, 0);
|
||||
}
|
||||
|
||||
return $file;
|
||||
|
@ -126,7 +126,7 @@ class XcacheClassLoader
|
||||
if (xcache_isset($this->prefix.$class)) {
|
||||
$file = xcache_get($this->prefix.$class);
|
||||
} else {
|
||||
$file = $this->decorated->findFile($class);
|
||||
$file = $this->decorated->findFile($class) ?: null;
|
||||
xcache_set($this->prefix.$class, $file);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user