Forge Cache is now available as part of Forge Early Access Program (EAP). To start testing this feature, sign up using this form.
Forge Cache is an experimental feature offered to selected users for testing and feedback purposes. This feature is unsupported and subject to change without notice. Do not use Forge Cache in apps that handle sensitive information and customer data.
For more details, see Forge EAP, Preview, and GA.
The @forge/cache
package throws errors along with their error codes. The following example shows how to handle an error when the app tries to store a value that exceeds the maximum allowed size.
1 2import { cache, errorCodes } from '@forge/cache'; try { const cacheClient = cache.connect(); await cacheClient.set("hello", 3, { ttlSeconds: 10 }); } catch (error) { if (error.code === errorCodes.MAX_VALUE_SIZE_EXCEEDED) { // Handle when value of key is above the max allowed value } }
Error code | Description |
---|---|
INVALID_KEY_TYPE | The provided key is not a string. Ensure that you are passing a string value for the key. |
MIN_VALID_KEY_LENGTH_REQUIRED | The provided key needs to be more than one character. See the Forge Cache limits for more details. |
INVALID_KEY_PATTERN | The provided key does not match the regular expression (regex). Ensure that the key matches the regex: /^(?!\s+$)[a-zA-Z0-9:._\s-#]+$/ |
VALUE_IS_NOT_A_STRING | The provided value is not a string type. Ensure the provided type of value is a string. |
VALUE_IS_REQUIRED | The provided value could not be found. Ensure there is a provided value. |
INVALID_VALUE_TYPE | The provided value is an invalid type type. Ensure the provided type of value is a string. |
MAX_VALUE_SIZE_EXCEEDED | The provided value has exceeded the maximum valid size of 240 KiB. See the Forge Cache limits for more details. |
INVALID_LIMIT_VALUE | The provided limit value is invalid. Ensure the provided value only contains digits and is between 30s and 3600s. See the Forge Cache limits for more details. |
Error code | Description |
---|---|
VALUE_IS_NOT_A_STRING | The provided value is not a string type. |
VALUE_IS_REQUIRED | Ensure there is a provided value. |
INVALID_VALUE_TYPE | The provided value is an invalid type type. Ensure the provided type of value is a string. |
MAX_VALUE_SIZE_EXCEEDED | The provided value has exceeded the maximum valid size of 240KiB. See the Forge Cache limits for more details. |
INVALID_LIMIT_VALUE | The provided limit value is invalid. Ensure the provided value only contains digits and is between 30s and 3600s. See the Forge Cache limits for more details. |
Error code | Description |
---|---|
INVALID_TTL_TYPE | The provided ttlSeconds is an invalid type.Ensure the provided type of value is an integer. |
VALUE_IS_REQUIRED | The provided value could not be found. Ensure there is a provided value. |
INVALID_VALUE_TYPE | The provided value is an invalid type type. Ensure the provided type of value is a string. |
MAX_VALUE_SIZE_EXCEEDED | The provided value has exceeded the maximum valid size. Ensure the provided value is under 240 KiB. See the Forge Cache limits for more details. |
INVALID_LIMIT_VALUE | The provided limit value is invalid. Ensure the provided value only contains digits and is between 30s and 3600s. See the Forge Cache limits for more details. |
Rate this page: