# Redisによるキャッシング (Node.js / NestJS) > Cache manager、Redis統合、キャッシュ戦略、TTL、無効化、分散キャッシュ - 20 面接問題 - Mid-Level - [面接問題: Node.js / NestJS](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions.md) ## 1. キャッシングの文脈におけるRedisとは何ですか? **回答** Redis(Remote Dictionary Server)は、主に分散キャッシュとして使用されるインメモリのキーバリュー型NoSQLデータベースです。従来のディスクベースのデータベースとは異なり、Redisはデータをメモリ(RAM)に保存するため、ミリ秒単位の応答時間を実現します。strings、hashes、lists、sets、sorted setsといった高度なデータ構造をサポートしており、さまざまなキャッシュパターンに対して非常に柔軟に対応できます。 ## 2. NestJSにRedisを統合するためにインストールすべきnpmパッケージはどれですか? **回答** NestJSにRedisを統合するには、@nestjs/cache-managerとcache-manager-redis-store(最近のバージョンではcache-manager-redis-yet)をインストールする必要があります。@nestjs/cache-managerパッケージは、NestJSのdependency injectionシステムと統合される公式のCacheModuleを提供します。cache-manager-redis-storeパッケージは、デフォルトのインメモリキャッシュの代わりにRedisをキャッシュバックエンドとして使用できるようにします。 ## 3. CacheModuleをRedisでグローバルに構成するにはどのメソッドを使用しますか? **回答** CacheModule.register()メソッドはモジュールに対してローカルにキャッシュを構成しますが、isGlobal: trueを指定したCacheModule.registerAsync()はアプリケーション全体でグローバルに利用可能にします。async方式では、ConfigServiceを注入して環境変数からRedisのURLを動的に取得できます。isGlobalを使用すると、アプリケーションの各モジュールでCacheModuleを再インポートする必要がなくなります。 ## さらに17問利用可能 - RedisキャッシュにおけるTTL(Time To Live)とは何ですか? - NestJSにおける@UseInterceptors(CacheInterceptor)デコレーターの目的は何ですか? 無料で登録: https://sharpskill.dev/ja/login ## その他のNode.js / NestJS面接トピック - [Node.js の基礎](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/nodejs-fundamentals.md): 20問, Junior - [Node.js コア API](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/nodejs-core-apis.md): 25問, Junior - [非同期プログラミング](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/asynchronous-programming.md): 25問, Junior - [Express.js の基礎](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/express-basics.md): 20問, Junior - [NestJSの基礎](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/nestjs-fundamentals.md): 23問, Junior - [REST API 設計](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/rest-api-design.md): 20問, Junior - [バリデーションとDTO](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/validation-dto.md): 20問, Junior - [APIドキュメントと契約](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/api-documentation.md): 20問, Junior - [エラーハンドリング](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/error-handling.md): 20問, Junior - [ユニットテスト](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/testing-unit.md): 20問, Junior - [タスクスケジューリング](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/scheduling-cron.md): 15問, Junior - [NestJS のモジュールと DI](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/nestjs-modules-di.md): 20問, Mid-Level - [設定と環境管理](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/configuration-environment.md): 20問, Mid-Level - [JWT認証](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/authentication-jwt.md): 25問, Mid-Level - [認可とRBAC](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/authorization-rbac.md): 20問, Mid-Level - [TypeORMによるデータベース](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/database-typeorm.md): 30問, Mid-Level - [Prisma ORM](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/prisma-orm.md): 25問, Mid-Level - [ミドルウェアとインターセプター](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/middleware-interceptors.md): 20問, Mid-Level - [ファイルアップロード](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/file-upload.md): 15問, Mid-Level - [WebSockets](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/websockets.md): 20問, Mid-Level - [NestJSによるGraphQL](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/graphql-basics.md): 25問, Mid-Level - [エンドツーエンドテスト](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/testing-e2e.md): 20問, Mid-Level - [Bull によるキュー](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/queues-bull.md): 20問, Mid-Level - [DevOps、Logging、CI/CD](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/logging-monitoring.md): 25問, Mid-Level - [Docker とコンテナ化](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/docker-containerization.md): 25問, Mid-Level - [マイクロサービス](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/microservices.md): 30問, Senior - [セキュリティのベストプラクティス](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/security-best-practices.md): 25問, Senior - [パフォーマンスとクラウドデプロイ](https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/performance-optimization.md): 30問, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ja/technologies/node-nestjs/interview-questions/caching-redis