# 3.3.8.API Caching (1 of 2) Concepts & Design decisions

* Who [cache](https://jenhsuan.gitbooks.io/asp-net/content/chapter3rest-api-design-development-and-management/32rest-api-architectural-constraints/325caching.html)
  * Caching can occur on any of point in the API path length. ![](/files/-M4M0XQNisMmFO4gFd-v)
  * Benefits
    * 1.Improves performance
    * 2.High Scalability/ Throughput
      * e.g., 客戶端需要60 calls/second, 但DB的極限只有50 calls/second, 因此可以在db前的端點做caching來解決這個問題
        * The closer the caching is done to the consumer the better will be the performance

          ![](/files/-M4M0XQPueqz4TfLWJel)
* What to cache/ How long to cache
  * 3 factors when designing cache implementation
    * 1.Speed of data change
    * 2.Time sensitivity
    * 3.Security
* Design decisions
  * 1.Which component should control the caching?
    * API server
  * 2.What to cache? who can cache?
  * 3.For how long is the cached data valid? &#x20;
    * Depends on the nature of the data


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jen-hsuan-hsieh.gitbook.io/asp-net/chapter3rest-api-design-development-and-management/33designing-rest-api/338api-caching-1-of-2-concepts-and-design-decisions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
