Class CacheOperationException

  • All Implemented Interfaces:
    Serializable

    public class CacheOperationException
    extends CacheException
    Exception thrown when cache operations fail at runtime.

    This exception indicates problems during cache operations such as:

    • Read/Write operation failures
    • Eviction strategy errors
    • Concurrency conflicts
    • Resource exhaustion

    Usage Examples:

    
     try {
         cache.put(key, value);
     } catch (CacheOperationException e) {
         if (e.isRetryable()) {
             // Implement retry logic
             retryOperation();
         } else {
             // Handle permanent failure
             logger.error("Cache operation failed permanently: " + e.getMessage());
         }
     }
     
    Since:
    1.0.0
    See Also:
    Serialized Form
    • Constructor Detail

      • CacheOperationException

        public CacheOperationException​(String message)
        Constructs a new cache operation exception with the specified detail message.
        Parameters:
        message - the detail message
      • CacheOperationException

        public CacheOperationException​(String message,
                                       Throwable cause)
        Constructs a new cache operation exception with the specified detail message and cause.
        Parameters:
        message - the detail message
        cause - the cause
      • CacheOperationException

        public CacheOperationException​(String message,
                                       String errorCode,
                                       boolean retryable)
        Constructs a new cache operation exception with specific error code and retryable flag.
        Parameters:
        message - the detail message
        errorCode - the specific operation error code
        retryable - whether this operation can be retried
      • CacheOperationException

        public CacheOperationException​(String message,
                                       Throwable cause,
                                       String errorCode,
                                       boolean retryable)
        Constructs a new cache operation exception with cause, error code and retryable flag.
        Parameters:
        message - the detail message
        cause - the cause
        errorCode - the specific operation error code
        retryable - whether this operation can be retried
    • Method Detail

      • invalidKey

        public static CacheOperationException invalidKey​(Object key)
        Creates an operation exception for key validation failures.
        Parameters:
        key - the invalid key
        Returns:
        a new CacheOperationException
      • invalidValue

        public static CacheOperationException invalidValue​(Object value)
        Creates an operation exception for value validation failures.
        Parameters:
        value - the invalid value
        Returns:
        a new CacheOperationException
      • concurrentModification

        public static CacheOperationException concurrentModification​(Object key)
        Creates an operation exception for concurrent modification conflicts.
        Parameters:
        key - the key involved in the conflict
        Returns:
        a new CacheOperationException
      • invalidCacheState

        public static CacheOperationException invalidCacheState​(String state)
        Creates an operation exception for cache state errors.
        Parameters:
        state - the invalid state
        Returns:
        a new CacheOperationException
      • evictionFailure

        public static CacheOperationException evictionFailure​(Throwable cause)
        Creates an operation exception for eviction failures.
        Parameters:
        cause - the underlying cause
        Returns:
        a new CacheOperationException
      • serializationFailure

        public static CacheOperationException serializationFailure​(Object key,
                                                                   Throwable cause)
        Creates an operation exception for serialization failures.
        Parameters:
        key - the key being serialized
        cause - the underlying cause
        Returns:
        a new CacheOperationException