Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Level 1 cache in Data API builder reduces redundant requests to the database by temporarily caching entity results in memory. This 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 TTL.
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-seconds
overrides globalttl-seconds
.
Notes
- Level 1 cache is in-memory only.
- Best suited for read-heavy scenarios with low data volatility.