diff --git a/README.md b/README.md index 0ff42d4..61bd1da 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,26 @@ module.exports = app => { }; ``` +## For the local dev + +Run docker compose to start test redis service + +```bash +docker compose -f docker-compose.yml up -d +``` + +Run the unit tests + +```bash +npm test +``` + +Stop test redis service + +```bash +docker compose -f docker-compose.yml down +``` + ## Questions & Suggestions Please open an issue [here](https://github.com/eggjs/egg/issues). diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8c9163a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +name: eggjs_redis_dev + +services: + redis: + image: redis:alpine + ports: + - 6379:6379 diff --git a/test/fixtures/apps/ts-multi/redisapp-ts/app/controller/home.ts b/test/fixtures/apps/ts-multi/redisapp-ts/app/controller/home.ts index afb2f60..792bbb8 100644 --- a/test/fixtures/apps/ts-multi/redisapp-ts/app/controller/home.ts +++ b/test/fixtures/apps/ts-multi/redisapp-ts/app/controller/home.ts @@ -14,6 +14,7 @@ declare module 'egg' { export default class HomeController extends Controller { async index() { const { ctx,app } = this; + // @deprecated please use `getSingletonInstance(id)` instead const redis = app.redis.get('cache') as unknown as Redis; await redis.set('foo', 'bar'); const redis2 = app.redis.getSingletonInstance('cache');