0

I am using APC cache for doctrine2, configured while bootstrapping:

$config = new \Doctrine\ORM\Configuration();

$cache = new \Doctrine\Common\Cache\ApcCache;

$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
$config->setResultCacheImpl($cache);

And configuration for php.ini:

[APC]
apc.shm_size = '128M'
apc.enabled=1
apc.shm_segments=1
apc.num_files_hint=0
apc.user_entries_hint=0
apc.ttl=0
apc.user_ttl=7200
apc.gc_ttl=3600
apc.stat=1
apc.enable_cli=0
apc.file_update_protection=2
apc.max_file_size=2M
apc.cache_by_default=1
apc.use_request_time=1
apc.slam_defense=0
apc.stat_ctime=0
apc.canonicalize=1
apc.write_lock=1
apc.report_autofilter=0
apc.rfc1867=0
apc.rfc1867_prefix =upload_
apc.rfc1867_name=APC_UPLOAD_PROGRESS
apc.rfc1867_freq=0
apc.rfc1867_ttl=3600
apc.lazy_classes=0
apc.lazy_functions=0 

APC cache dll extension for PHP is available upto php version 5.4 After 5.4 an inbuilt extension is available as an opcache but how to use it with doctrine2?

Jaskaran Singh
  • 2,392
  • 24
  • 39
  • If you really need apc with php > 5.4, you can use https://pecl.php.net/package/APCu – j0k Apr 22 '15 at 11:46
  • Ok great! I will try php_apcu.dll and seems that it will work. Do you know that why can't we use opcache instead of APC builtin in php.5.5 and higher versions? – Jaskaran Singh Apr 23 '15 at 04:49
  • 1
    Well, it shouldn't be a problem. See http://stackoverflow.com/q/21925354/569101 or http://www.sitepoint.com/understanding-opcache/ – j0k Apr 23 '15 at 07:57
  • Ok great, I have read the links you mentioned. Just one doubt will this line of code remains the same if I use opcache instead of APC: $cache = new \Doctrine\Common\Cache\ApcCache; – Jaskaran Singh Apr 23 '15 at 09:49
  • 1
    Of course not. But regarding [an other question](http://stackoverflow.com/a/18042566/569101) you should use apcu since opcache *is a simply opcode cache*. – j0k Apr 23 '15 at 13:05
  • So the conclusion is that we cannot use opcache with doctrine instead of APC/APCu. – Jaskaran Singh Apr 23 '15 at 13:23

0 Answers0