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


##########
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:
   Compared with Java's `RESTTableCache`: the property names, defaults, the 
`(session id, identifier)` key and the `304` handling all match. One 
difference: Java rejects `rest-table-cache.expire-after-write-ms` of `0` 
(`Preconditions.checkArgument(expireAfterWriteMS > 0, "Invalid expire after 
write: zero or negative")`), while here `0` is accepted. Should this reject `0` 
too, or document what `0` does?



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