English
Fx.lock
About 258 wordsLess than 1 minute
2026-01-09
Summary
The overview of this document is as follows: This document introduces the API definitions of Fx.lock, usage methods, and related notes.
1. lock uses Redisson's distributed lock, and the unlocking is performed by FxLock.unLock();
Fx.lock.lockData(<String apiName>, <String dataId>, <Integer expireTime>)
Request parameters
Request Body
| Parameter Name | Type | Description | Required |
|---|---|---|---|
| apiName | String | The API name of the object | Y |
| dataId | String | Data ID | Y |
| expireTime | Integer | Expiration time | Y |
Code examples
// Locking must be fine-grained to prevent lock contention waits
FxLock lock = Fx.lock.lockData("Account", "dataId", 2)
// Code section requiring lock protection
// do something
lock.unlock()Notice
- Error example: Using a coarse-grained lock like
lock("prepareData")can negatively impact business operations.- Instead, employ fine-grained locks such as data IDs to lock specific data entries, preventing concurrency issues.
Changelog
| Version | Date | Changes | Author |
|---|---|---|---|
| v1.0 | 2026-05-20 | Initial version |
Background
This document provides detailed information about the Fx.lock API functionality and usage, helping developers integrate relevant capabilities.
Applicable Scenarios
Specific applicable scenarios are determined by actual business needs. Developers can select the appropriate API for integration as required.
Prerequisites
- Access to Fxiaoke Open Platform
- Application authorization and configuration completed
- Basic knowledge of relevant business domain
Steps
Please refer to the detailed instructions for each API.
Notes
- Ensure prerequisites are met before calling APIs
- Pay attention to API call frequency limits
- Refer to error code documentation for exception handling
Compatibility note: This version currently has no deprecated or compatibility notes.
