Class ChangeNotesCache.Weigher

java.lang.Object
com.google.gerrit.server.notedb.ChangeNotesCache.Weigher
All Implemented Interfaces:
com.google.common.cache.Weigher<ChangeNotesCache.Key,ChangeNotesState>
Enclosing class:
ChangeNotesCache

public static class ChangeNotesCache.Weigher extends Object implements com.google.common.cache.Weigher<ChangeNotesCache.Key,ChangeNotesState>
  • Constructor Details

    • Weigher

      public Weigher()
  • Method Details

    • weigh

      public int weigh(ChangeNotesCache.Key key, ChangeNotesState state)

      Take all columns and all collection sizes into account, but use estimated average element sizes rather than iterating over collections. Numbers are largely hand-wavy based on http://stackoverflow.com/questions/258120/what-is-the-memory-consumption-of-an-object-in-java

      Should be kept up to date with ChangeNotesState. Please, keep weights listed in the same order as fields.

      Specified by:
      weigh in interface com.google.common.cache.Weigher<ChangeNotesCache.Key,ChangeNotesState>