English
Fx.cache
About 356 wordsAbout 1 min
2026-01-09
1. getDefaultCache DefaultCache
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
