CacheSpec Class — spring-boot Architecture
Architecture documentation for the CacheSpec class in CacheSpec.java from the spring-boot codebase.
Entity Profile
Source Code
build-plugin/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/CacheSpec.java lines 36–105
public class CacheSpec {
private final ObjectFactory objectFactory;
private @Nullable Cache cache;
@Inject
public CacheSpec(ObjectFactory objectFactory) {
this.objectFactory = objectFactory;
}
public @Nullable Cache asCache() {
return this.cache;
}
/**
* Configures a volume cache using the given {@code action}.
* @param action the action
*/
public void volume(Action<VolumeCacheSpec> action) {
if (this.cache != null) {
throw new GradleException("Each image building cache can be configured only once");
}
VolumeCacheSpec spec = this.objectFactory.newInstance(VolumeCacheSpec.class);
action.execute(spec);
this.cache = Cache.volume(spec.getName().get());
}
/**
* Configures a bind cache using the given {@code action}.
* @param action the action
*/
public void bind(Action<BindCacheSpec> action) {
if (this.cache != null) {
throw new GradleException("Each image building cache can be configured only once");
}
BindCacheSpec spec = this.objectFactory.newInstance(BindCacheSpec.class);
action.execute(spec);
this.cache = Cache.bind(spec.getSource().get());
}
/**
* Configuration for an image building cache stored in a Docker volume.
*/
public abstract static class VolumeCacheSpec {
/**
* Returns the name of the cache.
* @return the cache name
*/
@Input
public abstract Property<String> getName();
}
/**
* Configuration for an image building cache stored in a bind mount.
*/
public abstract static class BindCacheSpec {
/**
* Returns the source of the cache.
* @return the cache source
*/
@Input
public abstract Property<String> getSource();
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free