Heim  >  Fragen und Antworten  >  Hauptteil

php - memcache实现分布式算法问题

根据$key计算出在那个节点获取缓存的时候,PHP有没有内置函数能计算出$key一致性哈希值,从而根据hash取余得出具体那台服务器去获取缓存?

PHPzPHPz2723 Tage vor299

Antworte allen(2)Ich werde antworten

  • 怪我咯

    怪我咯2017-04-10 15:43:39

    php开源的memcached客户端一般都会自带一致性哈希算法。去github上搜搜看吧。

    Antwort
    0
  • 黄舟

    黄舟2017-04-10 15:43:39

    一致性哈希算法有多种具体实现。php 应该没有内置的函数,狠一点的话去看你所用memcached客户端的源码,把他的一致性哈希算法抠出来,自己用php 来实现。

    Antwort
    0
  • StornierenAntwort