Class RocksdbMavenPomCache

java.lang.Object
org.openrewrite.maven.cache.RocksdbMavenPomCache
All Implemented Interfaces:
MavenPomCache

public class RocksdbMavenPomCache extends Object implements MavenPomCache
Implementation of the maven cache that leverages Rocksdb. The keys and values are serialized to/from byte arrays using jackson. Things to know about this cache implementation:

  • It will create a rocks db in the workspace directory passed to it.
  • If two caches are pointed to the same workspace folder, they will "share" the same underlying rocks database, it is thread-safe.
  • Because multiple caches can share the same database, the close on this cache implementation does nothing.
  • The database is closed via a system shutdown hook registered by this class. Any unexpected process termination is non-fatal, any non-flushed data is lost, but the database will not be corrupted.
  • The database is configured to auto-flush when the in-memory size reaches 1MB.
  • Rocksdb's write ahead log has been disabled because we are using this as a cache and do not need to recover any "lost" data.
  • Rocksdb computes checksums for all of its files, normally it checks those on startup, this has been disabled as well.