This article mainly introduces the compilation and installation method of PHP extension of Tencent CMEM, and analyzes the functions, functions and installation and use skills of CMEM in more detail. I hope to be helpful.
The details are as follows:
What is CMEM?
CMEM, the full name of Cloud Memory, is a high-performance memory-level persistent storage service provided by Tencent. It is suitable for scenarios with small data volume, high access volume, and key-value storage.
CMEM is based on a hashmap that stores key/value pairs. The data is stored in memory and ensures the persistence of the data.
What is CMEM PHP Extension?
CMEM is based on the standard Memcached protocol and interface, but only adds return value settings to the data acquisition interface.
Memcached's Get protocol does not have a return code designed, so when the Memcached API returns NO_DATA, it may be caused by network reasons and cannot be fully trusted. It is very dangerous to use the following process, which will cause user data to be initialized:
if(NO_DATA) { InitData(); }
To solve the above problems, CMEM provides Memcahced text Extend the protocol and add two extended commands, get_ext and gets_ext, so that the client can determine whether the data exists based on the return code. This can avoid incorrect initialization of user data due to failure to obtain data when network and equipment failures occur.
CMEM compilation and installation
# 下载CMEM cd /home/src wget http://cmem.googlecode.com/files/cmem-2.2.6.tar.gz # 解压 tar zxvf cmem-2.2.6.tar.gz cd cmem-2.2.6 # 编译 /usr/local/webserver/php/bin/phpize ./configure --with-php-config=/usr/local/webserver/php/bin/php-config make # 安装PHP扩展 cp modules/cmem.so /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/ # 配置php.ini # 加入以下内容 # -------------------------------------------------- extension = "cmem.so" # -------------------------------------------------- # 测试 # 新建cmemtest.php cat > /tmp/cmemtest.php # 代码为 # -------------------------------------------------- <?php if(!class_exists('CMEM')) echo "CMEM NOT FOUND!\n"; else echo "CMEM IS OK\n"; ?> # -------------------------------------------------- # 执行测试文件 /usr/local/webserver/php/bin/php -f /tmp/cmemtest.php
Related recommendations:
Used in macOS phpize dynamically adds PHP extension error solution
PHP extension cURL compilation and installation under Linux
Compile and install PHP extension redis under Linux
The above is the detailed content of Compilation of PHP extension Tencent CMEM. For more information, please follow other related articles on the PHP Chinese website!