memoize a getter of an object