A static cache that can only grow has only limited use. We could, for example, use it to store RTTI properties of types, as access to the RTTI is relatively slow. In most cases, however, a limited-size cache that stores only N most recently used values is more appropriate.
Writing such a cache is quite a tricky operation. First and foremost, we need quick access to a value associated with a specific input (let's call that input a key). In Chapter 1, About Performance, we found out that the best way to do that is a hash table (or, in Delphi terms, TDictionary), which has O(1) lookup time.
So that's solved, our cache will store data in a dictionary. But we also have to remove the values from the dictionary (as this cache has a ...