Compilation of PHP extension Tencent CMEM

*文
Release: 2023-03-18 16:42:01
Original
1559 people have browsed it

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(); }
Copy after login


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 # 代码为 # --------------------------------------------------  # -------------------------------------------------- # 执行测试文件 /usr/local/webserver/php/bin/php -f /tmp/cmemtest.php
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!