$ sudo apt update
$ sudo apt install redis-server
$ sudo vi /etc/redis/redis.conf
supervised systemd
$ sudo systemctl restart redis.service
$ sudo systemctl status redis
● redis-server.service – Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor >
Active: active (running) since Thu 2022-07-14 09:02:47 UTC; 11s ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Process: 273821 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code>
Main PID: 273833 (redis-server)
Tasks: 4 (limit: 4677)
Memory: 2.0M
CGroup: /system.slice/redis-server.service
└─273833 /usr/bin/redis-server 127.0.0.1:6379
$ sudo apt install php-redis
$ redis-cli
127.0.0.1:6379> ping
set
$redis = new Redis(); $redis->connect('127.0.0.1', 6379); $redis->set('key', 'PHP'); $redis->close();
get
$redis = new Redis(); $redis->connect('127.0.0.1', 6379); $value = $redis->get('key'); print($value); $redis->close();
ほうほう、php-redisも何となく理解した