-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cb2289
commit 170e336
Showing
5 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Configuration.rootFile=grpc-api.prop | ||
workspace=. | ||
devroot=. | ||
|
||
deephaven.cache.dir=/cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
engine/table/src/main/java/io/deephaven/engine/util/CacheDir.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.deephaven.engine.util; | ||
|
||
import io.deephaven.configuration.Configuration; | ||
|
||
import java.nio.file.Path; | ||
|
||
/** | ||
* The cache directory is a directory that the application may use for storing data with "cache-like" semantics. | ||
* Cache-like data is data that may be preserved across restarts, but the application logic should not make the | ||
* assumptions that the data will be available. | ||
*/ | ||
public final class CacheDir { | ||
private static final String DEEPHAVEN_CACHE_DIR = "deephaven.cache.dir"; | ||
private static final String JAVA_IO_TMPDIR = "java.io.tmpdir"; | ||
|
||
private static final Path cacheDir; | ||
|
||
static { | ||
final Configuration config = Configuration.getInstance(); | ||
if (config.hasProperty(DEEPHAVEN_CACHE_DIR)) { | ||
cacheDir = Path.of(config.getProperty(DEEPHAVEN_CACHE_DIR)); | ||
} else { | ||
cacheDir = Path.of(System.getProperty(JAVA_IO_TMPDIR), "deephaven", "cache"); | ||
} | ||
} | ||
|
||
/** | ||
* Return the value for the configuration {@value DEEPHAVEN_CACHE_DIR} if it is present. | ||
* | ||
* <p> | ||
* Otherwise, return "%s/deephaven/cache", parameterized from the value of the system property | ||
* {@value JAVA_IO_TMPDIR}. | ||
* | ||
* @return the cache dir | ||
*/ | ||
public static Path get() { | ||
return cacheDir; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters