bxji commented on a change in pull request #4761: [TE] Centralized cache 
proof-of-concept for anomaly detection via Couchbase
URL: https://github.com/apache/incubator-pinot/pull/4761#discussion_r347687105
 
 

 ##########
 File path: 
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/ThirdEyeCacheRegistry.java
 ##########
 @@ -90,14 +98,42 @@ public static void initDataSources(ThirdEyeConfiguration 
thirdeyeConfig) {
     }
   }
 
+  public static void initCentralizedCache(ThirdEyeConfiguration 
thirdeyeConfig) {
+    try {
+      URL cacheConfigUrl = thirdeyeConfig.getCacheConfigAsUrl();
+      CacheConfig cacheConfig = 
CacheConfigLoader.fromCacheConfigUrl(cacheConfigUrl);
+      if (cacheConfig == null) {
+        throw new IllegalStateException("Could not get cache config from path 
" + cacheConfigUrl);
+      }
+
+      CacheDataSource dataSource = 
CacheConfig.getCentralizedCacheSettings().getDataSourceConfig();
+
+      cacheConfig.setHost(dataSource.getHost());
+      cacheConfig.setAuthUsername(dataSource.getAuthUsername());
+      cacheConfig.setAuthPassword(dataSource.getAuthPassword());
+      cacheConfig.setBucketName(dataSource.getBucketName());
+
+      if (INSTANCE.getTimeSeriesCache() == null) {
+        TimeSeriesCache timeSeriesCache = new 
DefaultTimeSeriesCache(DAO_REGISTRY.getMetricConfigDAO(), 
DAO_REGISTRY.getDatasetConfigDAO(),
+            ThirdEyeCacheRegistry.getInstance().getQueryCache(),
+            new CouchbaseCacheDAO(),
 
 Review comment:
   added todo

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to