palbaseDocs

Palbase Cache · API

PUT/cache/entry

Write an entry

Writes the value under key for ttl seconds (thirty days without one, and at most), replacing what was there. A value is any JSON, 512 KiB at most. Writing the same value again changes nothing but the time left, so the call is safe to send again. When the project's entries would pass its quota the ones nearest their end are dropped first (evicted).

Called by your server, with the project's secret key.

Query

keystring · requiredThe entry's key: UTF-8 text, 512 bytes at most. It is a query parameter, which a request's log line does not keep.

Request body

ttlinteger · optionalThe seconds the entry lasts, 1 to 2592000 (thirty days); thirty days without it.
valueany · requiredAny JSON, 512 KiB at most as it is sent.
curl
curl -X PUT "https://<your-ref>.palbase.studio/cache/entry" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"value":null}'

Responses

200The entry is written

400The key is missing, too long or not UTF-8; or the body is not the operation's

401Missing or invalid API key

403Not the project's secret key, or the secret key with a user's token beside it (`secret_key_required`)

413The value is over 512 KiB (`value_too_large`, `request_too_large`), or the entry is larger than the project's whole cache (`entry_too_large`)

429Over the project's cache calls a second or its bytes a second (`rate_limited`); retrying is safe after Retry-After

503The cache could not be reached (`cache_unavailable`), or takes no more at this moment (`cache_busy`); retrying is safe after Retry-After

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation PutCacheEntry of cache's contract.