Xuanwo commented on PR #6297:
URL: https://github.com/apache/opendal/pull/6297#issuecomment-2979678131

   My current understanding of the cache layer is that it is a very thin 
component that simply wraps two (or more) OpenDAL operators. The cache policy 
and strategy should be defined by a separate trait. I haven't explored this 
idea in depth yet, but it might look something like the following:
   
   ```rust
   let cache_layer = CacheLayer::builder()
       .route("*.hint", WholeCache::new(1024), memory_cache)
       .route("*.json", FixedSizeCache::new(64 << 20), memory_cache)
       .route("*.parquet", ParquetCache::new(), foyer_cache)
       .build()?;
   let op = op.layer(cache_layer);
   ```
   
   All `FixedSizeCache` and `ParquetCache` are implementations of the 
`CachePolicy` trait and can be provided by users. OpenDAL can offer some 
default implementations as a starting point. In other words, the cache layer 
itself does not make any decisions for users.
   


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

Reply via email to