当前位置:网站首页>Swoole内存-table详解
Swoole内存-table详解
2022-07-27 22:38:00 【生命不止、战斗不息】
内存操作模块
Lock Buffer Table Atomic mmap channel serialize
介绍
swooletable是一个基于共享内存和锁实现的超高性能,并发数据结构
优势
- 性能强悍,单线程每秒可读写200万次
- 应用代码无需加锁,Table内置行锁自旋锁,所有操作均是多线程/多进程安全。用户层完全不需要考虑数据同步问题;
- 支持多进程,Table可以用于多进程之间共享数据
- 使用行锁,而不是全局锁,仅当2个进程在同一cpu时间,并发读取同一条数据才会进行发生抢锁
table.php
<?php
//创建内存表
$table = new \Swoole\Table(1024);
//内存表增加一列
$table->column('id', $table::TYPE_INT,4);
$table->column('name', $table::TYPE_STRING,64);
$table->column('age', $table::TYPE_INT,3);
$table->create();
$table->set('wyt',['id'=>1,'name'=>'wyt','age'=>18]);
print_r($table->get('wyt'));结果
自增
$table->incr('wyt','age',2);自减
$table->decr('wyt','age',2);边栏推荐
- Multithreading and multithreaded programming
- Use of postman
- Circular structure of shell system learning
- 小波变换学习笔记
- R language evaluates the relative importance of the predictive factors (variables, characteristics) of the regression model, scales the predictive variables of the regression model, and then construct
- 网络设备硬核技术内幕 防火墙与安全网关篇 (六) 安全双修大法 下
- 跨桌面端Web容器演进
- At least 42 employees are infected with novel coronavirus! Nokia announces closure of telecom equipment plant in India
- 7. Typescript part Foundation
- "C language" deep entry rounding & four functions
猜你喜欢

Data visualization - White Snake 2: black snake robbery (3)

UML类图的六大关系,最佳学习理解方式

融云 IM & RTC 能力上新盘点

IP address & subnet mask

Multithreading & high concurrency (the latest in the whole network: interview questions + map + Notes) the interviewer is calm

C语言程序设计 | offsetof宏的讲解及其模拟实现
![[BuildRelease Management]Parabuild](/img/80/11c2b539c217ecd6ba55668d3e71e9.png)
[BuildRelease Management]Parabuild

C language programming | single dog topic explanation

Recommend a Hongmeng instant messaging software "fruit chat", which is a bit awesome!!

Postman download and use tutorial
随机推荐
进程与进程调度
Iperf installation and use
C language programming | single dog topic explanation
Data visualization - White Snake 2: black snake robbery (3)
Rongyun IM & RTC capabilities on new sites
Jointly create a new chapter in cultural tourism | xinqidian signs a strategic cooperation agreement with Guohua cultural tourism
学习笔记12:Eratosthenes筛选法求素数(100以内) 和 魔方阵
Jericho will make a popping sound when turning on, broadcasting a prompt tone, and turning off [chapter]
如果某个表有近千万数据,CRUD比较慢,如何优化
Self use drawing bed building tutorial
MySQL中的运算符
Network equipment hard core technology insider firewall and security gateway chapter (VI) security double repair under the law
C语言程序设计 | offsetof宏的讲解及其模拟实现
Ford SUV "Mustang" officially went offline, safe and comfortable
scrollview、tableView嵌套解决方案
Network device hard core technology insider firewall and security gateway (IX) virtualization artifact (II)
Multithreading & high concurrency (the latest in the whole network: interview questions + map + Notes) the interviewer is calm
函数相关知识
7. Typescript part Foundation
Jerry Zhi has problems in real-time adjustment of sound change effect in magic sound mode [chapter]