Add @memoize decorator for caching function call results

Test Plan: -

Reviewers: marcua

Reviewed By: marcua

Differential Revision: https://phabricator.locu.com/D6800