duansao20000508 2012-08-27 10:29
浏览 34
已采纳

APC操作码缓存如何识别类?

I'm running a one instance Apache setup with multiple virtual hosts that runs different versions of the same code base.

By this I mean that one virtual host can server one version of a class and another can server second version of the same class (same namespace, same name).

/file/path/host-a/MyClass.php
/file/path/host-b/MyClass.php

Sometimes I get an exception that shows me that one of the virtual hosts uses the "wrong" version of a class. E.g. on host b I get an exception with file path to script of /file/path/host-a/MyClass.php

I thought that the APC optcode cache used the file path, at least as a part of the key, but I'm fearing, that it only uses a qualified class name like:

My\Namespace\MyClass

Is that the case? Please point to any documentation on this subject if possible.

  • 写回答

1条回答 默认 最新

  • douke1942 2012-08-28 10:25
    关注

    Answer

    Though is was unable to find any documentation on the answer to this question php - APC opcode caching on different file versions explains that the APC optcode cache in fact does use the path of the file that defines the class to distinguis classes with the same name.

    Debugging

    After @hakra pointed out to me the behaviour of APC, I was able focus my efforts on the class loader. My class loader uses memcached as cache for storing the class paths. It turned out that the code for building cache keys were the cause of the problem - and not the APC which it seemed to be.

    So should you be in a similar situation where your see that the incorrect "versions" of a class is loaded ensure that you class loader is working as expected. One obvious clue is of course the file path of the problem class.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥15 复杂网络,变滞后传递熵,FDA