palbaseDocs

Palbase Cache · API

POST/cache/entry/increment

Count up an entry

Adds one to the entry's count and answers the new count, atomically: two callers never get the same number. An entry that is not there, or holds something that is not a whole number, counts from zero. A count keeps the time it had left; a new one lasts thirty days. A count stops short of sixteen digits. Sent again, it counts again — and when the cache could not be reached (503) the count may already have been taken.

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.
curl
curl -X POST "https://<your-ref>.palbase.studio/cache/entry/increment" \
  -H "apikey: $PALBASE_SECRET_KEY"

Responses

200The new count

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`)

409The entry's count would pass fifteen digits (`count_too_large`); nothing is counted

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`): the count may have been taken — read the entry before counting again

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

Operation IncrementCacheEntry of cache's contract.