OpenResty中的ngx.location.capture和ngx.location.capture_multi使用 有更新!

  |   0 评论   |   0 浏览
  • = 表示将 URI 作为字符串,以便于参数中的 URI 做完全匹配。
  • ~ 表示匹配 URI 时,字母大小写是敏感的。
  • ~*表示匹配 URI 时,忽略字母大小写。
  • ^~ 表示匹配 URI 时,只需要前半部分与 uri 参数匹配即可。
  • @表示用于 nginx 服务器内部请求之间的重定向,带有@的 location 不直接处理用户请求。
  • uri 参数可以使用正则表达式。
  • 使用 locaiton / {}可以匹配所有的请求。
  • 首先匹配 =,其次匹配 ^~, 其次是按文件中顺序的正则匹配,最后是交给 / 通用匹配。当有匹配成功时候,停止匹配,按当前匹配规则处理请求。
  • = 精确匹配会第一个被处理。如果发现精确匹配,nginx 停止搜索其他匹配。
  • 普通字符匹配,正则表达式规则和长的块规则将被优先和查询匹配,也就是说如果该项匹配还需去看有没有正则表达式匹配和更长的匹配。

Redis高可用集群、哨兵模式(Redis-Sentinel)搭建配置详解 有更新!

  |   0 评论   |   0 浏览

由于本地环境的使用,所以搭建一个本地的 Redis 集群,本篇讲解 Redis 主从复制集群的搭建,使用的平台是 Windows。为了使得集群在一部分节点下线或者无法与集群的大多数节点进行通讯的情况下, 仍然可以正常运作, Redis 集群对节点使用了主从复制功能: 集群中的每个节点都有 1 个至 N 个复制品(replica), 其中一个复制品为主节点(master), 而其余的 N-1 个复制品为从节点(slave)。
wKiom1N3nPbS5JMAAHj5MGbf50000jpg

Why Redis beats Memcached for caching 有更新!

  |   0 评论   |   0 浏览

Memcached or Redis? It’s a question that nearly always arises in any discussion about squeezing more performance out of a modern, database-driven Web application. When performance needs to be improved, caching is often the first step taken, and Memcached or Redis are typically the first places to turn.

These renowned cache engines share a number of similarities, but they also have important differences. Redis, the newer and more versatile of the two, is almost always the superior choice.