Advanced Memoization — Handle Object Arguments with Deep Equality and Cache Eviction (Part 2)
Extend the basic memoize implementation to handle complex scenarios: memoizing functions that take object or array arguments (using deep equality or serialization for cache key matching), adding a maxSize option with LRU (Least Recently Used) eviction, supporting cache invalidation by key, and optionally using WeakMap for automatic garbage collection when object arguments go out of scope. This covers production-grade memoization used in React.memo, useMemo, and selector libraries.