spdx / Spdx-Java-Library

Java library which implements the Java object model for SPDX and provides useful helper functions
Apache License 2.0
35 stars 33 forks source link

Addresses issue 193 #205

Closed pmonks closed 1 year ago

pmonks commented 1 year ago

This PR addresses issue #193 by adding a configurable download cache to the library, and updating org.spdx.storage.listedlicense.SpdxListedLicenseWebStore to use that cache. This new cache is disabled by default.

Note that this PR also adds a test-only log4j2-test.xml file to the test resources of the project, but for some reason it doesn't seem to be getting picked up. After some thought I came to the conclusion that it's probably worth leaving this file in the source code as a visible reminder that it would be great to get to the bottom of that.

Note:

pmonks commented 1 year ago

In my testing locally (on a 4yo MacBook Pro), when the cache is enabled and the entire SPDX listed license & exception corpus is accessed, ~620 files totaling ~20MB are stored in the cache. There are the same number of metadata JSON files written, though they are much smaller (~2MB in total).

Once the cache is fully populated, the time the library spent loading the corpus went from ~4 minutes to ~1 second.