Skip to content

[Cache] TraceableAdapter #21082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Dec 28, 2016

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets Related to #21065
License MIT
Doc PR n/a

I moved the TraceableAdapter to a separate PR and added some tests. I found a small bug which was fixed.

public static function setupBeforeClass()
{
parent::setupBeforeClass();
self::$redis = new \Redis();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd base this on FilesystemAdapter so that more people can run the tests

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks... I just want an adapter that can run all tests.

@nicolas-grekas
Copy link
Member

👍

$event->end = microtime(true);
}

if ($event->result) {
Copy link
Member

@nicolas-grekas nicolas-grekas Dec 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thinking twice about this, I'd prefer removing this if/else now :) $event->result already allows to infer it, and it could be controversial to map true==hasItem to a hit. wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt the same. I'll gather this info in the DataCollector instead.

}

/**
* @internal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really make sense to tag the event class as internal when we return it in the getCalls() method?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for removing the tag then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 after this change

@xabbuh
Copy link
Member

xabbuh commented Dec 28, 2016

👍

Status: Reviewed


public function getCalls()
{
return $this->calls;
Copy link
Member

@nicolas-grekas nicolas-grekas Dec 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about resetting $this->calls here? This would allow reusing the same adapter several times in a long running process with no mem leak.

$calls = $this->calls;
$this->calls = array();

return $calls;

or

try {
    return $this->calls;
} finally {
    $this->calls = array();
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, makes sense

* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*/
class TraceableAdapter implements AdapterInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt it more a wrapper then a adapter as the class doesnt adapt one api for another?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly seen you are right. But I think it would be weird to change the name as we are implementing the AdapterInterface here, wouldn't it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see

@nicolas-grekas
Copy link
Member

Thank you @Nyholm.

nicolas-grekas added a commit that referenced this pull request Dec 29, 2016
This PR was squashed before being merged into the 3.3-dev branch (closes #21082).

Discussion
----------

[Cache] TraceableAdapter

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | Related to #21065
| License       | MIT
| Doc PR        | n/a

I moved the TraceableAdapter to a separate PR and added some tests. I found a small bug which was fixed.

Commits
-------

5cc4baf [Cache] TraceableAdapter
@Nyholm
Copy link
Member Author

Nyholm commented Dec 29, 2016

Thank you for merging

@Nyholm Nyholm deleted the cache-traceable-adapter branch December 29, 2016 12:07
@fabpot fabpot mentioned this pull request May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants