Implement a function lru_memoize(capacity) that returns a decorator. When applied to a function, the decorator caches return values so that repeated calls with equivalent arguments do not re-run the wrapped function. The cache must hold at most 'capacity' entries; once full, adding a new entry removes the least-recently-used one. A call counts as a 'use' on both a cache hit and a cache miss.
The cache must treat calls as equivalent when they carry the same information, even if the surface form differs:
Return the cached value for repeated equivalent calls. Both lookups and insertions must run in average O(1) time. Each wrapper exposes the underlying cache as wrapper.cache.