Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Memoize objects #1

Description

@michaelbaudino

We should memoize already downloaded objects.
For example, the following snippet should execute only one request to the API:

TimestampAPI::Project.find(123)
TimestampAPI::Project.find(123)

Also, the following snippet should require project 123 only once:

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:

project1 = TimestampAPI::Project.find(1)
project2 = TimestampAPI::Project.find(2)
project1.client === project2.client # => true

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions