github-actions[bot] commented on code in PR #31122:
URL: https://github.com/apache/doris/pull/31122#discussion_r1494865217


##########
be/src/olap/lru_cache.h:
##########
@@ -479,8 +489,11 @@
     void* value(Handle* handle) override;
     Slice value_slice(Handle* handle) override;
     uint64_t new_id() override { return 0; };
-    int64_t prune() override { return 0; };
-    int64_t prune_if(CacheValuePredicate pred, bool lazy_mode = false) 
override { return 0; };
+    int64_t prune(int64_t* freed_size = nullptr) override { return 0; };
+    int64_t prune_if(CachePrunePredicate pred, int64_t* freed_size = nullptr,

Review Comment:
   warning: method 'prune_if' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static int64_t prune_if(CachePrunePredicate pred, int64_t* freed_size = 
nullptr,
   ```
   



##########
be/test/olap/lru_cache_test.cpp:
##########
@@ -106,26 +106,26 @@
         return r;
     }
 
-    void Insert(int key, int value, int charge) {
+    void Insert(int key, int value, int charge) const {
         std::string result;
         cache()->release(cache()->insert(EncodeKey(&result, key), 
EncodeValue(value), charge,
                                          &CacheTest::Deleter));
     }
 
-    void InsertDurable(int key, int value, int charge) {
+    void InsertDurable(int key, int value, int charge) const {
         std::string result;
         cache()->release(cache()->insert(EncodeKey(&result, key), 
EncodeValue(value), charge,
                                          &CacheTest::Deleter, 
CachePriority::DURABLE));
     }
 
-    void Erase(int key) {
+    void Erase(int key) const {

Review Comment:
   warning: method 'Erase' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static void Erase(int key) {
   ```
   



##########
be/test/olap/lru_cache_test.cpp:
##########
@@ -106,26 +106,26 @@
         return r;
     }
 
-    void Insert(int key, int value, int charge) {
+    void Insert(int key, int value, int charge) const {
         std::string result;
         cache()->release(cache()->insert(EncodeKey(&result, key), 
EncodeValue(value), charge,
                                          &CacheTest::Deleter));
     }
 
-    void InsertDurable(int key, int value, int charge) {
+    void InsertDurable(int key, int value, int charge) const {

Review Comment:
   warning: method 'InsertDurable' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static void InsertDurable(int key, int value, int charge) {
   ```
   



##########
be/test/olap/lru_cache_test.cpp:
##########
@@ -90,11 +90,11 @@ class CacheTest : public testing::Test {
 
     CacheTest() : _cache(new CacheTestPolicy(kCacheSize)) { _s_current = this; 
}
 
-    ~CacheTest() { delete _cache; }
+    ~CacheTest() override { delete _cache; }
 
-    Cache* cache() { return _cache->cache(); }
+    Cache* cache() const { return _cache->cache(); }
 
-    int Lookup(int key) {
+    int Lookup(int key) const {

Review Comment:
   warning: method 'Lookup' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static int Lookup(int key) {
   ```
   



##########
be/test/olap/lru_cache_test.cpp:
##########
@@ -106,26 +106,26 @@
         return r;
     }
 
-    void Insert(int key, int value, int charge) {
+    void Insert(int key, int value, int charge) const {

Review Comment:
   warning: method 'Insert' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static void Insert(int key, int value, int charge) {
   ```
   



##########
be/src/olap/lru_cache.h:
##########
@@ -408,8 +417,9 @@ class ShardedLRUCache : public Cache {
     virtual void* value(Handle* handle) override;
     Slice value_slice(Handle* handle) override;
     virtual uint64_t new_id() override;
-    virtual int64_t prune() override;
-    int64_t prune_if(CacheValuePredicate pred, bool lazy_mode = false) 
override;
+    virtual int64_t prune(int64_t* freed_size = nullptr) override;

Review Comment:
   warning: 'virtual' is redundant since the function is already declared 
'override' [modernize-use-override]
   
   ```suggestion
       int64_t prune(int64_t* freed_size = nullptr) override;
   ```
   



-- 
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: commits-unsubscr...@doris.apache.org

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


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

Reply via email to