Class TwoLevelFileCache

java.lang.Object
rocks.imsofa.ai.puppychatter.cache.TwoLevelFileCache

public class TwoLevelFileCache extends Object
the first level is a partial key i.e. a key that may have conflicts the second level is a map with a real key and content the cache implementation allows only text contents
Author:
lendle
  • Constructor Details

    • TwoLevelFileCache

      public TwoLevelFileCache(File cacheRoot)
  • Method Details

    • getFromCache

      public String getFromCache(String identifier) throws Exception
      Parameters:
      identifier - the original identifier of the content to be cached, will be encoded to be saved to file system
      Returns:
      Throws:
      Exception
    • save2Cache

      public void save2Cache(String identifier, String content) throws Exception
      Parameters:
      identifier - the original identifier of the content to be cached, will be encoded to be saved to file system
      content -
      Throws:
      Exception
    • encode2PartialKey

      public String encode2PartialKey(String identifier) throws Exception
      a partial key allows duplication to be resolved later
      Parameters:
      identifier -
      Returns:
      Throws:
      Exception
    • encode2RealKey

      public String encode2RealKey(String identifier) throws Exception
      Throws:
      Exception