Junior — Middle+
Create a cache with FIFO eviction policy
livecode
Task condition
It is necessary to implement a limited size cache, where deletion occurs according to the "first in, first out" rule. When attempting to add an element that exceeds the maximum size, the earliest added element should be removed (regardless of how often it was accessed). The get function should return the stored value, and if the key is absent — -1.
put(int, int) // adds a value by key
get(int) int // returns the value by key, or -1 if not found