smiklosovic commented on code in PR #4114:
URL: https://github.com/apache/cassandra/pull/4114#discussion_r2058431278


##########
src/java/org/apache/cassandra/cache/ChunkCache.java:
##########
@@ -326,4 +327,13 @@ public long weightedSize()
                 .map(policy -> 
policy.weightedSize().orElseGet(cache::estimatedSize))
                 .orElseGet(cache::estimatedSize);
     }
+
+    /**
+     * Returns the number of cached chunks of given file.
+     */
+    @VisibleForTesting
+    public int sizeOfFile(String filePath)
+    {
+        return (int) cache.asMap().keySet().stream().filter(x -> 
x.path.equals(filePath)).count();

Review Comment:
   Depending on this being on a hot path or not we might contemplate about 
removing streams in favor of plain for loop.
   
   https://lists.apache.org/thread/65glsjzkmpktzmns6j9wvr4nczvskx36



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to