Embeddable uses Cube’s built-in caching (official docs here).
pre_aggregations
to the bottom of your model files.refresh-context
API below, to tell us which security contexts to keep the cache warm for.Refresh contexts tell Embeddable which pre_aggregations to keep warm.
// for security reasons, this must *never* be called from your client-side
fetch('<https://api.embeddable.com/api/v1/caching/refresh-contexts>', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${apiKey}` /* keep your API Key secure */
},
body: JSON.stringify({
refreshInterval: "30 minutes",
scheduledRefreshContexts: [
{
securityContext: {
userId: '9sZSJ9LHsiYXR0cmli',
regions: ['us-east', 'eu-west']
},
timezones: ['UTC', 'Europe/London'],
environment: 'default'
},
{
securityContext: {
userId: 'dXRlIjoiZ2VvaXBf',
regions: ['us-west']
},
timezones: ['UTC', 'America/New_York'],
environment: 'dev'
},
// ...
]
})
});
Response:
Status 204 (No Content)
Note: if you are connecting to a Redshift database, please contact us to discuss setting up pre-aggregations.