一、app.run() 在做什麼?
執行 app.run() 便啓動了 Flask 服務,這個服務為什麼能夠監聽 http 請求並做出響應?讓我們進入 run 函數內部一探究竟。
def run(self, host='localhost', port=5000, **options):
from werkzeug import run_simple
if 'debug' in o
kubernetes indexer源碼解析
kubernetes indexer是實現了多索引的本地緩存
1.背景
以db中學校學生表做本地緩存為例
type Student struct {
ID uint32
Name string
Class uint32
}
// 本地緩存,id和學生的映射
var idCache = map[uint32]Student{}
先從makefile入手,我這裏是基於redis 7.2.3的源碼。
# Top level makefile, the real shit is at src/Makefile
default: all
.DEFAULT:
cd src $(MAKE) $@
install:
cd src $(MAKE) $@
.PHONY: install
先來看看makefil
react-router-config主要用來幫助我們進行集中式路由的配置,在不使用react-router-config之前,我們的路由使用react-router-dom庫來進行配置,類似如下代碼:
import React from 'react';
import {
BrowserRouter as Router,
Switch,
Route,
} from "react-ro