Response objects from Momento APIs
These are the baseline responses for all commands. Some commands will add more data and functionality.
Commands fall generally into two categories. Those which respond with:
- Success or Error - An example is a Set operation. Either the item was successfully written to the cache or it errored.
- Hit, Miss, or Error - An example is a Get operation. If the requested item is in the cache, you have a cache Hit. If it is not in the cache, you get a cache Miss. If there is some sort of error, you get an Error.
Returned in lieu of an exception.
- innerException: Exception - the exception which caused the error
- message(): String - a human readable error message
- innerException(): Exception - the original exception.
- errorCode(): MomentoErrorCode - Momento’s own category of errors such as InvalidArgument or BadRequest. See Standards And Practices - Error Handling
- toString(): String - alias for message()
The command was successful.
The key or field exists in the cache. Usually extended to return a value.
The key or field does not exist in the cache.
For TTL commands, the update was applied successfully.
For TTL commands, the update was not applied and no change was made to the existing TTL.
For setIfNotExists commands, the key did not exist and the value was set.
For setIfNotExists commands, the key existed and no value was set.