YuangGao commented on code in PR #3377:
URL: https://github.com/apache/iceberg-rust/pull/3377#discussion_r4236643085


##########
crates/catalog/rest/src/catalog.rs:
##########
@@ -297,6 +309,24 @@ impl RestCatalogConfig {
             .unwrap_or(false)
     }
 
+    /// Builds the table cache for freshness-aware loading.
+    fn table_cache(&self) -> Result<TableCache> {
+        let parse = |key: &str, default: u64| -> Result<u64> {
+            self.props.get(key).map_or(Ok(default), |v| {
+                v.parse().map_err(|e| {
+                    Error::new(ErrorKind::DataInvalid, format!("Invalid {key}: 
{v}")).with_source(e)
+                })
+            })
+        };
+        Ok(TableCache::builder()
+            .max_capacity(parse(REST_CATALOG_PROP_TABLE_CACHE_MAX_ENTRIES, 
100)?)
+            .time_to_live(Duration::from_millis(parse(

Review Comment:
   good catch, thanks. `0` is now rejected like in Java, since it's ambiguous 
(disable vs never expire) and `max-entries=0` already turns the cache off. 
while there, also capped it at 1000 years, which moka would otherwise panic on.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to