magibney commented on PR #1899: URL: https://github.com/apache/solr/pull/1899#issuecomment-1738322438
The last three commits (through b8124677d7c88b903b5f3c4fd24ca8a54596d215) introduce a subtle but substantial change that abstracts all the "metadata wrapper" accounting so that application code (SolrIndexSearcher, other users of caches) know nothing about any potential metadata wrappers around cache value entries. The cleanest place to do this is from the regenerator; I've added `wrap()` and `unwrap()` methods to `CacheRegenerator`, with a default passthrough implementation. Regenerators that require value-entry metadata accounting (such as access timestamp, individual entry hit count, etc.) may override `wrap()` to return a simple `SolrCache<K, V>` view of an underlying `SolrCache<K, MetadataWrapper<V>>` cache. It is the _raw_ cache (unwrapped) that is autowarmed, providing the regenerator with the information it needs to make warming decisions, etc. But it is the _wrapped_ cache that is presented for all normal cache interactions. This approach works equally well for implementing more nuanced cache metrics (histograms, dumping cache contents, etc.). The overall approach is described in the [javadocs here](https://github.com/apache/solr/blob/b8124677d7c88b903b5f3c4fd24ca8a54596d215/solr/core/src/java/org/apache/solr/search/MetaCacheRegenerator.java#L36-L62). It should be quite trivial to implement regenerators that implement custom metrics. -- 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: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org