I understand the policy of this forum regarding help on assignments... but I'm not asking anyone
to write anything.. I just want help understanding what they want.
Ok here's part of the first question:
entries use an Object as the key and an Object as the stored value. Duplicate keys are not allowed
The cache supports a fixed number of total entries and does not grow. Rather, the cache will support various eviction strategies to removing old entries (least recently used, for example)
Supported operations of this cache include the following:
create(size) -- creates the cache with a maximum number of entries, specified by size
add(key, value) -- adds an entry to the cache, if an object already exists with the same key, replace the value with the new value, if the key does not already exist in the cache, then add the entry specified by key/value into the cache, evicting an existing entry, if necessary
get(key) -- retrieves the value of the entry specified by key or null if no entry exists
exists(key) -- returns true if an entry with key exists in the cache, false otherwise
And then they want me to implement 2 different evictions techniques..
So this is what I was thinking they wanted me to do:
store objects in a fixed size array and later implement a method for evicting
stored objects when the array is full.... am I on the right track?
One thing I dont understand from this is that is says: "entries use an Object as the key and an Object as the stored value"
I dont understand this... why do they use an object for the key? Cant the key just be an integer?
What do they mean by key? Do they want me to create a hashing algorithm? If not, could I just use the index of
each stored object as their key??
Another part that confuses me is the 3rd question, it says:
What do they mean by this? Do I have the first part of this test wrong?
What do they mean by: "robustness and high-availability"? Are they asking me to redesign
the program so that memory is not as much of an issue? I really don't understand this part.
Also, when they say design... what should I use to design this?