[ClassLoader] Use symfony/polyfill-apcu
This commit is contained in:
parent
54d7f2dfb9
commit
623595f0d6
|
@ -38,8 +38,9 @@ before_install:
|
||||||
- echo session.gc_probability = 0 >> $INI_FILE
|
- echo session.gc_probability = 0 >> $INI_FILE
|
||||||
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi;
|
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi;
|
||||||
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi;
|
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi;
|
||||||
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE) || echo "Let's continue without apcu extension"; fi;
|
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE); fi;
|
||||||
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi;
|
- if [[ $TRAVIS_PHP_VERSION = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi;
|
||||||
|
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0; fi;
|
||||||
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi;
|
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi;
|
||||||
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
|
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
|
||||||
- if [[ $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer-auth.json ~/.composer/auth.json; fi;
|
- if [[ $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer-auth.json ~/.composer/auth.json; fi;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
"php": ">=5.3.3",
|
"php": ">=5.3.3",
|
||||||
"doctrine/common": "~2.4",
|
"doctrine/common": "~2.4",
|
||||||
"paragonie/random_compat": "~1.0",
|
"paragonie/random_compat": "~1.0",
|
||||||
|
"symfony/polyfill-apcu": "~1.0,>=1.0.2",
|
||||||
"twig/twig": "~1.23|~2.0",
|
"twig/twig": "~1.23|~2.0",
|
||||||
"psr/log": "~1.0"
|
"psr/log": "~1.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -67,8 +67,8 @@ class ApcClassLoader
|
||||||
*/
|
*/
|
||||||
public function __construct($prefix, $decorated)
|
public function __construct($prefix, $decorated)
|
||||||
{
|
{
|
||||||
if (!extension_loaded('apc')) {
|
if (!function_exists('apcu_fetch')) {
|
||||||
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.');
|
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not installed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!method_exists($decorated, 'findFile')) {
|
if (!method_exists($decorated, 'findFile')) {
|
||||||
|
@ -122,8 +122,8 @@ class ApcClassLoader
|
||||||
*/
|
*/
|
||||||
public function findFile($class)
|
public function findFile($class)
|
||||||
{
|
{
|
||||||
if (false === $file = apc_fetch($this->prefix.$class)) {
|
if (false === $file = apcu_fetch($this->prefix.$class)) {
|
||||||
apc_store($this->prefix.$class, $file = $this->decorated->findFile($class));
|
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
],
|
],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.3"
|
"php": ">=5.3.3",
|
||||||
|
"symfony/polyfill-apcu": "~1.0,>=1.0.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/finder": "~2.0,>=2.0.5"
|
"symfony/finder": "~2.0,>=2.0.5"
|
||||||
|
|
Reference in New Issue