-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract memory cache and register with cache manager
- Loading branch information
1 parent
b1c9de9
commit 7d096ba
Showing
3 changed files
with
45 additions
and
8 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
35 changes: 35 additions & 0 deletions
35
src/configmanager/src/main/java/org/endeavourhealth/common/config/ConfigCache.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,35 @@ | ||
package org.endeavourhealth.common.config; | ||
|
||
import org.endeavourhealth.common.cache.ICache; | ||
import org.endeavourhealth.common.config.models.ConfigCacheEntry; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ConfigCache implements ICache { | ||
private static Map<String, ConfigCacheEntry> _configCache = new HashMap<>(); | ||
|
||
@Override | ||
public String getName() { | ||
return "ConfigCache"; | ||
} | ||
|
||
@Override | ||
public long getSize() { | ||
return _configCache.size(); | ||
} | ||
|
||
@Override | ||
public void clearCache() { | ||
_configCache.clear(); | ||
} | ||
|
||
|
||
public ConfigCacheEntry get(String configId, String appId) { | ||
return _configCache.get(configId + appId); | ||
} | ||
|
||
public void put(String configId, String appId, ConfigCacheEntry cacheEntry) { | ||
_configCache.put(configId + appId, cacheEntry); | ||
} | ||
} |
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