java.lang.Object
test.CacheManager
-
Constructor Summary
ConstructorsConstructorDescriptionCacheManager(int size, CacheReplacementPolicy crp) The CacheManager constructor is responsible to initialize all the data members of the class. -
Method Summary
-
Constructor Details
-
CacheManager
The CacheManager constructor is responsible to initialize all the data members of the class.- Parameters:
size- int -Set the maxsize of the cachecrp- CacheReplacementPolicy -Determine which cache replacement policy to use
-
-
Method Details
-
query
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
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
-