Class SummaryCache

java.lang.Object
io.github.jbastgen.stemma.app.ai.SummaryCache

public final class SummaryCache extends Object
Descriptions that were already asked for, one small file each in the configuration folder, so asking again is free. The key covers the commits, the model and the prompt template: changing the model or editing the template asks again.
  • Constructor Details

    • SummaryCache

      public SummaryCache(Path dir)
      Parameters:
      dir - the folder of the cache; created when the first summary is stored
  • Method Details

    • key

      public static String key(String provider, String model, String template, List<String> commitIds)
      The key of a summary: a hash of provider, model, template and commits, so a change of any of them asks again.
    • get

      The stored summary, if there is one and it can be read.
    • put

      public void put(String key, CommitSummary.Summary s)
      Stores a summary and removes the oldest ones when there are too many.
    • clear

      public int clear()
      Removes every cached description. @return how many
    • size

      public int size()
      How many summaries are stored.