category: redis

redis - note

on 2019-09-05

redis - note

doc

http://redisdoc.com/index.html

php redis

https://www.cnblogs.com/ikodota/archive/2012/03/05/php_redis_cn.html

go redis

https://godoc.org/github.com/go-redis/redis

連到 redis server

  • local server
redis-cli
  • remote server
redis-cli -h host -p port -a password

Get all key

KEYS '*'

Troubleshooting

ERR Operation against a key holding the wrong kind of value

取 Key 的類型不對

type <KEY>

來確認存的類型

Mac - php redis install

on 2019-06-19

Mac - php redis install

Mac Env

Mac OSX 10.14.5

Step

git clone https://www.github.com/phpredis/phpredis.git

cd phpredis

phpize && ./configure && make && sudo make install

test

php -r "if (new Redis() == true){ echo \"\r\n OK \r\n\"; }"

Troubleshooting

phpize

1.

$ phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:

Solution

cd /Library/Developer/CommandLineTools/Packages/

open macOS_SDK_headers_for_macOS_10.14.pkg

2.

$ phpize
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.

Solution

brew install autoconf

Refer - install-phpredis-mac-osx

Refer - macOS 10.14软件编译时找不到头文件的解决方法

Refer - macOS 中使用 phpize 动态添加 PHP 扩展的错误解决方法

Read more