Package test

Class CacheManager

java.lang.Object
test.CacheManager

public class CacheManager extends Object
  • Constructor Details

    • CacheManager

      public CacheManager(int size, CacheReplacementPolicy crp)
      The CacheManager constructor is responsible to initialize all the data members of the class.
      Parameters:
      size - int -Set the maxsize of the cache
      crp - CacheReplacementPolicy -Determine which cache replacement policy to use
  • Method Details

    • query

      public boolean query(String word)
      The query function takes in a string and returns true if the word is in the dictionary, false otherwise.
      Parameters:
      word - String -Check if the word is in the words arraylist
      Returns:
      True if the word is in the dictionary, false otherwise
    • add

      public void add(String word)
      The add function adds a word to the cache. If the cache is full, it removes a word from the cache depending on the CacheReplacementPolicy, then adds the given word.
      Parameters:
      word - String