Class OpenCacheException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.cache.exception.OpenCacheException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ResilientCacheLoader.LoaderException, TimeoutCache.CacheTimeoutException
Open Cache Exception - Unified exception for cache operations
OpenCache 异常 - 缓存操作的统一异常
Extends OpenException to maintain consistent exception hierarchy.
继承 OpenException 以保持一致的异常体系。
Features | 主要功能:
- Cache name tracking - 缓存名称跟踪
- Key information - 键信息
- Cause chaining - 原因链
Usage Examples | 使用示例:
// Create exception - 创建异常
throw new OpenCacheException("users", "user:1001", "Failed to load user");
// With cause - 带原因
throw new OpenCacheException("users", "user:1001", cause);
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
- Null-safe: Yes - 空值安全: 是
- Since:
- JDK 25, opencode-base-cache V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOpenCacheException(String message) Create exception with message 使用消息创建异常OpenCacheException(String cacheName, Object key, String message) Create exception with cache name, key and message 使用缓存名称、键和消息创建异常OpenCacheException(String cacheName, Object key, String message, Throwable cause) Create exception with cache name, key, message and cause 使用缓存名称、键、消息和原因创建异常OpenCacheException(String cacheName, Object key, Throwable cause) Create exception with cache name, key and cause 使用缓存名称、键和原因创建异常OpenCacheException(String message, Throwable cause) Create exception with message and cause 使用消息和原因创建异常 -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenCacheExceptioncapacityExceeded(String cacheName, long maxCapacity) Create capacity exceeded exception 创建容量超出异常Get cache name 获取缓存名称getKey()Get key 获取键static OpenCacheExceptionloadingFailed(String cacheName, Object key, Throwable cause) Create loading exception 创建加载异常static OpenCacheExceptionCreate timeout exception 创建超时异常Methods inherited from class OpenException
getComponent, getErrorCode, getMessage, getRawMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
OpenCacheException
Create exception with message 使用消息创建异常- Parameters:
message- the message | 消息
-
OpenCacheException
-
OpenCacheException
-
OpenCacheException
-
OpenCacheException
-
-
Method Details
-
getCacheName
-
getKey
-
loadingFailed
Create loading exception 创建加载异常- Parameters:
cacheName- cache name | 缓存名称key- the key | 键cause- the cause | 原因- Returns:
- exception | 异常
-
timeout
Create timeout exception 创建超时异常- Parameters:
cacheName- cache name | 缓存名称key- the key | 键- Returns:
- exception | 异常
-
capacityExceeded
Create capacity exceeded exception 创建容量超出异常- Parameters:
cacheName- cache name | 缓存名称maxCapacity- maximum capacity | 最大容量- Returns:
- exception | 异常
-