Package org.apache.maven.api.cache
@Experimental
package org.apache.maven.api.cache
Provides a caching infrastructure for Maven requests and their results.
This package contains the core components for implementing and managing caches in Maven:
RequestCache
- The main interface for caching request resultsRequestCacheFactory
- Factory for creating cache instancesCacheMetadata
- Configuration for cache behavior and lifecycle
The caching system supports different retention periods through CacheRetention
:
- PERSISTENT - Data persists across Maven invocations
- SESSION_SCOPED - Data retained for the duration of a Maven session
- REQUEST_SCOPED - Data retained only for the current build request
- DISABLED - No caching performed
Example usage:
RequestCache cache = cacheFactory.createCache(); Result result = cache.request(myRequest, req -> { // Expensive operation to compute result return computedResult; });
The package also provides support for batch operations through BatchRequestException
and RequestResult
which help manage multiple requests and their results.
- Since:
- 4.0.0
-
ClassDescriptionException thrown when a batch request operation fails.Interface defining metadata for cache behavior and lifecycle management.Enumeration defining different retention periods for cached data.Exception thrown when an error occurs during Maven execution.Interface for caching request results in Maven.Factory interface for creating new RequestCache instances.A record representing the result of a single request operation, containing the original request, the result (if successful), and any error that occurred during processing.