V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
hheedat
V2EX  ›  PHP

PHP apcu 扩展,进程之间是安全的么?

  •  
  •   hheedat · Dec 1, 2017 · 2707 views
    This topic created in 3073 days ago, the information mentioned may be changed or developed.

    搜了下,没找到明确的资料,官方文档也没有提及,望知情人士解答一下,谢谢了

    https://pecl.php.net/package/APCu

    http://php.net/apcu

    https://stackoverflow.com/questions/45168588/is-apc-store-thread-safe

    apcu

    2 replies    2017-12-01 20:19:53 +08:00
    picone
        1
    picone  
       Dec 1, 2017   ❤️ 1
    是线程安全的。

    apcu 内部是有定义锁的相关宏,有两对锁:APC_LOCK 和 APC_UNLOCK,APC_RLOCK 和 APC_RUNLOCK,具体实现似乎平台,在 apc_lock.c 中有相关的实现。
    在 apcu 在根据 key 来进行查找时会使用 APC_RLOCK 锁定这个 key,插入、删除和修改时会有使用 APC_LOCK 锁定,具体实现在 apc_cache.c
    hheedat
        2
    hheedat  
    OP
       Dec 1, 2017
    @picone 感谢你的回复
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1385 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 16:31 · PVG 00:31 · LAX 09:31 · JFK 12:31
    ♥ Do have faith in what you're doing.