Change serialization functions in PHP for Memcached

后端 未结 2 2060
长情又很酷
长情又很酷 2021-01-16 10:54

By default Memcached module in PHP uses PHP\'s built in serialization functions. Because I\'m accesing the same keys from other programming languages, I have found a seriali

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-16 11:27

    Just put your serialized data in a string and save it with memcache,

    $memcache->add('your_key', str, false, 30);
    

    If the serailization generates binary data. You should base64 encode it yourself because PHP's binary encoding is very in-efficient.

提交回复
热议问题