基于Redis的邮件异步发送工具
jianfly.com 2019-01-31 2519次浏览
安装redis
redis.io官网下载并解压
make PREFIX=/usr/local/redis intall
mkdir -p usr/local/redis/etc/
将redis.config复制到/usr/local/redis/etc/redis.conf
启动脚本utils/redis_init_script修改
做软链
mkdir /etc/redis
ln -s /usr/local/redis/etc/redis.conf /etc/redis/6379.conf
复制启动脚本
cp redis_init_script /etc/init.d/redis
启动
/etc/init.d/redis start
后台运行
自动启动
chkconfig –add redis
chkconfig redis on
之后的启动和停止命令
service redis start
service redis stop
下载phpredis拓展,解压,进入phpredis
命令:phpize
./configure –with-php-config=/usr/local/php/bin/php-config
make && make install
vim /usr/local/php/etc/php.ini
github上下载yiisoft/yii2-redis
php composer.phar require –prefer-dist yiisoft/yii2-redis
web.php中增加配置
Yii::$app->redis->set(“phpredis”, “100”); //赋值
var_dump(Yii::$app->redis->keys(“*”)); //打印所有
echo Yii::$app->redis->get(“phpredis”); //获取值
- 上一篇:缓存机制和Url美化
- 下一篇:全文检索ElasticSearch