Skip to content

Extending the life of object in cache

There are two way to extend object's life in cache - relative timeframe and fixed timeframe. With the relative timeframe a period of time is added to the timestamp of the call to determine the new expiration time. The fixed timestamp approach sets the timestamp when the object must expire from cache.

Method:

PUT

URL

Relative extension:

https://api.backendless.com/<application-id>/<REST-api-key>/cache/<key>/expireIn?timeout=<seconds>

Fixed timestamp:

https://api.backendless.com/<application-id>/<REST-api-key>/cache/<key>/expireAt?timestamp=<timestamp>

where:

Argument                Description
<application id> ID of the application which can be obtained from the Manage > App Settings screen of the Backendless Console
<REST-api-key> REST API key of your application. You can get the value from the Manage > App Settings section of the Backendless Console.
<key> identifies the object to extend the life of in cache.
<seconds> number of seconds to extend the life of object in cache by. Must be a value between 1 and 7200 (2 hours).
<timestamp> a timestamp in milliseconds when the object should expire and removed from cache. The difference between timestamp and the current time must be greater than zero, equal or less than 7200000 milliseconds (2 hours).

Request headers

Content-Type: application/json  
user-token: optional value obtained as a result of the login operation.

where:

Argument                Description
Content-Type Must be set to application/json. This header is mandatory.
user-token Optional header. Contains a value returned by Backendless in a preceding user Login API call. If user-token is set in the request, the currently logged in user will be assigned to the ownerId property of the user object which is being saved.  Additionally, the operation will be executed with the security policy associated currently logged in user. This means all permissions associated with the user and the roles assigned to the user will be enforced by Backendless.

Request body

N/A

Example

Relative time extension:

curl -X PUT \  
https://api.backendless.com/XXXX-XXXX-XXXX/ZZZZ-ZZZZ-ZZZZ/cache/myorder/expireIn?timeout=1200

Absolute time extension:

curl -X PUT \  
https://api.backendless.com/XXXX-XXXX-XXXX/ZZZZ-ZZZZ-ZZZZ/cache/myorder/expireAt?timestamp=1407213507898