Class CacheManager

java.lang.Object
Model.gameClasses.CacheManager

public class CacheManager extends Object
  • Constructor Details

    • CacheManager

      public CacheManager(int size, CacheReplacementPolicy crp)
      the CacheManager constructor gets the size of the cache structure and the cacheReplacementPolicy
      Parameters:
      size - the size of the cache policy
      crp - the cache replacement policy (LFU, LRU...)
  • Method Details

    • query

      public boolean query(String word)
      Parameters:
      word - a word to check if it exists in cache
      Returns:
      whether the given word exists or not
    • add

      public void add(String word)
      Parameters:
      word - add the word to the cache and if the cache is full - remove a word using the policy of the cache.