หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Level 1 cache in Data API builder reduces redundant requests to the database by temporarily caching entity results in memory. This caching improves performance for frequent queries and avoids hitting the database unnecessarily.
Enable cache globally
To enable caching, set the global runtime configuration:
"runtime": {
"cache": {
"enabled": true,
"ttl-seconds": 60
}
}
enabled: Required. Turns on caching globally.ttl-seconds: Optional. Defines the default time-to-live (in seconds) for cached items.
Enable cache per entity
Each entity must also opt in to use cache:
"MyEntity": {
"cache": {
"enabled": true,
"ttl-seconds": 30
}
}
enabled: Required. Enables caching for this specific entity.ttl-seconds: Optional. If not specified, inherits from the global time-to-live (TTL) value.
Behavior
- Applies only to REST endpoints.
- Works on a per-route, per-parameter basis.
- Cache is invalidated when data is modified (create, update, delete).
- Entity
ttl-secondsoverrides globalttl-seconds.
Notes
- Level 1 cache is in-memory only.
- Best suited for read-heavy scenarios with low data volatility.