[Groonga-commit] groonga/groonga at 5d2c354 [master] cache: expire old caches when the max N caches is decreased

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Apr 15 18:11:18 JST 2015


Kouhei Sutou	2015-04-15 18:11:18 +0900 (Wed, 15 Apr 2015)

  New Revision: 5d2c35442791cf8427d757b64c68e8425632983a
  https://github.com/groonga/groonga/commit/5d2c35442791cf8427d757b64c68e8425632983a

  Message:
    cache: expire old caches when the max N caches is decreased
    
    Suggested by Gurunavi, Inc. Thanks!!!

  Modified files:
    lib/ctx.c

  Modified: lib/ctx.c (+8 -0)
===================================================================
--- lib/ctx.c    2015-04-15 12:44:00 +0900 (ba5199a)
+++ lib/ctx.c    2015-04-15 18:11:18 +0900 (077272e)
@@ -1734,10 +1734,18 @@ grn_cache_init(void)
 grn_rc
 grn_cache_set_max_n_entries(grn_ctx *ctx, grn_cache *cache, unsigned int n)
 {
+  uint32_t current_max_n_entries;
+
   if (!cache) {
     return GRN_INVALID_ARGUMENT;
   }
+
+  current_max_n_entries = cache->max_nentries;
   cache->max_nentries = n;
+  if (n < current_max_n_entries) {
+    grn_cache_expire(cache, current_max_n_entries - n);
+  }
+
   return GRN_SUCCESS;
 }
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index