此应用返回一个 Github 账户拥有的仓库数量。当您首次搜索某个账户时,服务器会调用 Github 的 API 来返回响应。这可能需要一些时间。然后,服务器将此慢响应的详细信息添加到 Redis 中,以供未来的请求使用。当您再次搜索时,下一个响应会直接从 Redis 缓存中获取,而无需调用 Github。响应速度会快得多。
brew install node
git clone https://github.com/redis-developer/basic-caching-demo-nodejs
- REDIS_ENDPOINT_URI: Redis server URI
- REDIS_PASSWORD: Password to the server
cd client
yarn
yarn serve
yarn
yarn start
打开 https://localhost:8081,您可以看到一个基本的缓存演示应用正在运行。