We should memoize already downloaded objects. For example, the following snippet should execute **only one** request to the API: ``` ruby TimestampAPI::Project.find(123) TimestampAPI::Project.find(123) ``` Also, the following snippet should require project 123 **only once**: ``` ruby task = TimestampAPI::Project.find(123).tasks.first task.project ``` We already do it on an object (calling `task.project` twice on the same object only trigger one API call), we should do it globally. Objects could thus be shared, this would be great in the end: ``` ruby project1 = TimestampAPI::Project.find(1) project2 = TimestampAPI::Project.find(2) project1.client === project2.client # => true ```
We should memoize already downloaded objects.
For example, the following snippet should execute only one request to the API:
Also, the following snippet should require project 123 only once:
We already do it on an object (calling
task.projecttwice on the same object only trigger one API call), we should do it globally.Objects could thus be shared, this would be great in the end: