@Immutable
public static final class FileCache.Inputs
extends java.lang.Object
FileCache.
The clients of FileCache need to exhaustively specify all the inputs that affect
the creation of an output file/directory to the FileCache.Inputs object, including a command
for the file creator callback function, the input files/directories and other input
parameters. A command identifies a file creator (which usually corresponds to a Gradle task)
and is used to separate the cached results of different file creators when they use the same
cache. If the client uses a different file creator, or changes the file creator's
implementation, then it needs to provide a new unique command. For input files/directories,
it is important to select a combination of properties that uniquely identifies an input
file/directory depending on the specific use case (common properties of a file/directory
include its path, name, hash, size, and timestamp; it is usually good practice to use both
the path and hash to identify an input file/directory).
When constructing the FileCache.Inputs object, the client is required to provide the command
(via the FileCache.Inputs.Builder constructor) and at least one other input parameter.
The input parameters have the order in which they were added to this Inputs
object. If a parameter with the same name exists, the parameter's value is overwritten
(retaining its previous order).
Note that if some inputs are missing, the cache may return a cached file/directory that is incorrect. On the other hand, if some irrelevant inputs are included, the cache may create a new cached file/directory even though an existing one can be used. In other words, missing inputs affect correctness, and irrelevant inputs affect performance. Thus, the client needs to consider carefully what to include and exclude in these inputs.
| Modifier and Type | Class and Description |
|---|---|
static class |
FileCache.Inputs.Builder
Builder of
FileCache.Inputs. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getKey()
Returns a key representing this list of input parameters.
|
java.lang.String |
toString() |
@NonNull public java.lang.String toString()
toString in class java.lang.Object@NonNull public java.lang.String getKey()
Inputs object. Two lists of input
parameters are considered different if the input parameters are different in size, order,
or values. This method guarantees to return different keys for different lists of inputs.