CLUSTER INFO
打印集群的信息
CLUSTER NODES
列出集群当前已知的所有节点(node),以及这些节点的相关信息。
<?php | |
function distance($data1, $data2) { | |
$num = 0; | |
for ($i = 0; $i < sizeof($data1); $i++) { | |
$num += pow($data1[$i] - $data2[$i], 2); | |
} | |
return sqrt($num); | |
} |
127.0.0.1:12345> TTL key # 尚未过期 | |
(integer) 3 | |
127.0.0.1:12345> TTL key | |
(integer) 1 | |
127.0.0.1:12345> TTL key # 虽然键已经过期,但因为我阻塞住了主服务器, | |
(integer) 0 # 而主服务器没办法向从服务器发送 DEL 命令,所以值会一直滞留在从服务器里面。 | |
127.0.0.1:12345> GET key | |
"value" | |
127.0.0.1:12345> TTL key | |
(integer) 0 |
The ngx_http_core_module module supports embedded variables with names matching the Apache Server variables. First of all, these are variables representing client request header fields, such as $http_user_agent, $http_cookie, and so on. Also there are other variables:
# Makefile for a go project | |
# | |
# Author: Jon Eisen | |
# site: joneisen.me | |
# | |
# Targets: | |
# all: Builds the code | |
# build: Builds the code | |
# fmt: Formats the source files | |
# clean: cleans the code |
There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.
So, these are the different settings we are going to compare:
package main | |
import "fmt" | |
// Constant definitions | |
const MaxUint = ^uint(0) | |
const MinUint = 0 | |
const MaxInt = int(^uint(0) >> 1) | |
const MinInt = -MaxInt - 1 |
In open Ubuntu 18.04 machine click Parallels Actions -> "Install Parallels Tools"
A "Parallels Tools" CD will popup on your Ubuntu desktop.
Open it by double mouse click, copy all the content to a new, empty directory on a desktop, name it for e.g. "parallels_fixed"
Open terminal, change directory to parallels_fixed (cd ~/Desktop/parallels_fixed
)
Make command line installer executable (chmod +x install
)
Change directory to "installer" (cd installer
)
Make few other scripts executable: chmod +x installer.* *.sh prl_*
// ==UserScript== | |
// @name nospm | |
// @version 1.1 | |
// @description 移除虾米、淘宝和天猫网址中的 spm 参数(包括地址栏和页面中的链接) | |
// @include *://*.xiami.com/* | |
// @include *://*.taobao.com/* | |
// @include *://*.tmall.com/* | |
// ==/UserScript== | |
let forEach = Function.call.bind([].forEach) |
Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.
I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).