English
Fx.cache
About 499 wordsAbout 2 min
2026-01-09
Table of Contents
Summary
The overview of this document is as follows: This document introduces the API definitions of Fx.cache, usage methods, and related notes.
1. getDefaultCache DefaultCache
Fx.cache.getDefaultCache()
Code examples
Cache cache = Fx.cache.getDefaultCache();
log.info(cache.get("key1"));
//The unit for put is seconds, valid range is 1~172800
cache.put("key1", 1234, 5);
log.info(cache.contains("key1"));
Integer value = (Integer) cache.get("key1");
log.info(value);
log.info(cache.inc("key1"));
if(cache.remove("key1")) {
log.info("remove success!");
}
log.info(cache.get("key1"));Reference Interface
- Reference guide: Cache
Notice
- Limitations
- Maximum key string length: 256
- Maximum value string length: 1M
- Maximum expiration time: 48h
- Unit: seconds
Reference object com.fxiaoke.functions.interfaces.Cache
Field description
| Parameter Name | object | Description |
|---|
1. checks if the cache key exists
Check if the cache key exists
Cache.contains()
Owner:斯作益seth
2. put Insert key-value pair
Insert Key-Value Pair
Cache.put()
Owner:斯作益seth
3. get (Deprecated) - Retrieves a value by key. Returns null if the key does not exist. The return type is Object and requires type conversion (e.g., as String / as Integer) based on requirements.
Deprecated. Retrieves value by key, returns null if key does not exist. The return type is Object and requires type conversion (e.g., as String / as Integer) based on requirements.
Cache.get()
Owner:斯作益seth
4. getString retrieves a value by key, returning the result as a String type
Get value by key, the return result type is String
Cache.getString()
Owner:斯作益seth
5. getInteger retrieves a value by key and returns the result as an Integer type
Retrieve value by key, returns Integer type
Cache.getInteger()
Owner:斯作益seth
6. getLong retrieves a value by key and returns the result as a Long type
Get value by key, the return type is Long
Cache.getLong()
Owner:斯作益seth
7. remove Delete cache
Clear Cache
Cache.remove()
Owner:斯作益seth
8. inc increments a numeric key (string values are not supported)
Increment the numeric key by one (string values are not supported)
Cache.inc()
Owner:斯作益seth
9. Decrement the numeric key by one (string values are not supported)
Decrement the numeric key by one (string values are not supported)
Cache.dec()
Owner:斯作益seth
Changelog
| Version | Date | Changes | Author |
|---|---|---|---|
| v1.0 | 2026-05-20 | Initial version |
Background
This document provides detailed information about the Fx.cache 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.
