Skip to content

Commit 1968670

Browse files
committed
📚 Add section on the library's configuration options, notably the WebStore's new cache
1 parent 8175594 commit 1968670

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,30 @@ The methods enterCriticalSection and leaveCritialSection are available to suppor
2020
The library is available in [Maven Central org.spdx:java-spdx-library](https://search.maven.org/artifact/org.spdx/java-spdx-library).
2121

2222
If you are using Maven, you can add the following dependency in your POM file:
23-
```
23+
```xml
2424
<dependency>
2525
<groupId>org.spdx</groupId>
2626
<artifactId>java-spdx-library</artifactId>
2727
<version>(,1.0]</version>
2828
</dependency>
2929
```
3030

31-
[API JavaDocs are available here.](https://spdx.github.io/Spdx-Java-Library/)
31+
[API JavaDocs are available here](https://spdx.github.io/Spdx-Java-Library/).
3232

3333
There are a couple of static classes that help common usage scenarios:
3434

35-
- org.spdx.library.SPDXModelFactory supports the creation of specific model objects
36-
- org.spdx.library.model.license.LicenseInfoFactory supports the parsing of SPDX license expressions, creation, and comparison of SPDX licenses
35+
- `org.spdx.library.SPDXModelFactory` supports the creation of specific model objects
36+
- `org.spdx.library.model.license.LicenseInfoFactory` supports the parsing of SPDX license expressions, creation, and comparison of SPDX licenses
37+
38+
## Configuration options
39+
40+
`Spdx-Java-Library` is configured using Java system properties, as those allow both human operator configuration (via JVM `-D` command line options) as well as programmatic configuration by downstream code that needs automated control.
41+
42+
Currently the library offers these configuration options:
43+
1. `org.spdx.storage.listedlicense.SpdxListedLicenseWebStore.enableCache` - a boolean that enables or disables the WebStore's local cache. Defaults to `false` (the cache is disabled). The cache location is determined as per the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) i.e. `${XDG_CACHE_HOME}/Spdx-Java-Library` or `${HOME}/.cache/Spdx-Java-Library`).
44+
2. `org.spdx.storage.listedlicense.SpdxListedLicenseWebStore.cacheCheckIntervalSecs` - a long that controls how often each cache entry is rechecked for staleness, in units of seconds. Defaults to 86,400 seconds (24 hours). Set to 0 (zero) to have each cache entry checked every time (note: this will result in a lot more network I/O and negatively impact performance, albeit not as much as not using the cache at all).
45+
46+
Note that both of these configuration options can only be modified prior to initialization of Spdx-Java-Library. Once the library is initialized, subsequent changes to either or both of these Java properties will have no effect.
3747

3848
## Update for new properties or classes
3949
To update Spdx-Java-Library, the following is a very brief checklist:

0 commit comments

Comments
 (0)