TryGetValue<T> attempts to retrieve a value from IMemoryCache by key. It returns true when an entry exists and conditionally places the retrieved value in an out parameter; otherwise, it returns false. section 8.3.3
A cache-or-query implementation uses it to:
- Build a request-specific key by combining the input type name with its JSON serialization. section 8.3.3
- Skip the database query when the cache contains a matching BoardGame[] value. section 8.3.3
- Use the explicit generic type for clarity, although the compiler can infer it from the result variable. section 8.3.3
Verify a cache hit
Place a breakpoint on TryGetValue and another on the database-retrieval branch. Call the GET /BoardGames endpoint with default parameters: the first request should reach both points, while a repeated matching request should skip database retrieval when its entry remains cached. section 8.3.3
