-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add data governance related functionality
- Loading branch information
Showing
28 changed files
with
445 additions
and
130 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
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 +1 @@ | ||
version=5.1.1 | ||
version=6.0.0 |
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
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
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,61 +1,27 @@ | ||
package com.configcat; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.Closeable; | ||
import java.io.IOException; | ||
|
||
/** | ||
* A cache API used to make custom cache implementations for {@link ConfigCatClient}. | ||
*/ | ||
public abstract class ConfigCache { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigCache.class); | ||
private String inMemoryValue; | ||
|
||
public String get() { | ||
try { | ||
return this.read(); | ||
} catch (Exception e) { | ||
LOGGER.error("An error occurred during the cache read", e); | ||
return this.inMemoryValue; | ||
} | ||
} | ||
|
||
public void set(String value) { | ||
try { | ||
this.inMemoryValue = value; | ||
this.write(value); | ||
} catch (Exception e) { | ||
LOGGER.error("An error occurred during the cache write", e); | ||
} | ||
} | ||
|
||
/** | ||
* Through this getter, the in-memory representation of the cached value can be accessed. | ||
* When the underlying cache implementations is not able to load or store its value, | ||
* this will represent the latest cached configuration. | ||
* | ||
* @return the cached value in memory. | ||
*/ | ||
public String inMemoryValue() { return this.inMemoryValue; } | ||
|
||
/** | ||
* Child classes has to implement this method, the {@link ConfigCatClient} | ||
* uses it to get the actual value from the cache. | ||
* | ||
* @param key the key of the cache entry. | ||
* @return the cached configuration. | ||
* @throws Exception if unable to read the cache. | ||
*/ | ||
protected abstract String read() throws Exception; | ||
protected abstract String read(String key) throws Exception; | ||
|
||
/** | ||
* * Child classes has to implement this method, the {@link ConfigCatClient} | ||
* uses it to set the actual cached value. | ||
* | ||
* @param key the key of the cache entry. | ||
* @param value the new value to cache. | ||
* @throws Exception if unable to save the value. | ||
*/ | ||
protected abstract void write(String value) throws Exception; | ||
protected abstract void write(String key, String value) throws Exception; | ||
} | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.configcat; | ||
|
||
/** | ||
* The available values for data governance. | ||
*/ | ||
public enum DataGovernance { | ||
GLOBAL, | ||
EU_ONLY | ||
} |
Oops, something went wrong.