Skip to content

Conversation

@ycecube
Copy link

@ycecube ycecube commented Nov 6, 2018

@ycecube ycecube requested review from cnovak and mxr576 November 6, 2018 12:28
$developer->attributes[$attribute['name']] = @$attribute['value'];
foreach ($response['attributes'] as $key => $attribute) {
if (is_array($attribute)) {
$developer->attributes[$attribute['name']] = @$attribute['value'];
Copy link
Contributor

Choose a reason for hiding this comment

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

What kind of errors needs to be suppressed here? The only that I can imagine is the 'value' index does not exist which should not happen.

$developer->createdBy = $response['createdBy'];
$developer->modifiedAt = $response['lastModifiedAt'];
$developer->modifiedBy = $response['lastModifiedBy'];
$developer->modifiedAt = array_key_exists('lastModifiedAt', $response) ? $response['lastModifiedAt'] : $response['modifiedAt'];
Copy link
Contributor

Choose a reason for hiding this comment

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

In which circumstances we get back "modifiedAt" instead of "lastModifiedAt"?

Copy link
Author

Choose a reason for hiding this comment

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

It's different on the object and on the response... I had to make sure it is compatible.

$data[$organization] = array(
'developers' => array(),
'all_cached' => false,
'all_expanded' => false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would you cache non-expanded developer objects? That is just an other complexity that you have to deal with. Developer cache should contain only fully loaded developer objects.

Also, if you would like to use a complex structure like this for static cache I'd rather recommend you to create an object for that and instead of this array. It is not just complicated to work with an array, but also can cause performance degradation.

https://steemit.com/php/@crell/php-use-associative-arrays-basically-never

Copy link
Contributor

@mxr576 mxr576 Nov 13, 2018

Choose a reason for hiding this comment

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

Also, are you sure that we should introduce the static cache in the PHP SDK level not just in the Drupal 7 module? I do not know how many 3rd party apps relies on the V1 SDK but maybe we could handle this performance problem only in the Drupal 7 module. Therefore we would only need to deal with possible problems (bugs) that these changes may introduce in one place instead of two.
(Just an idea.)
PS.: I haven't implemented static caching in the V2 PHP API client, because if consumer apps needs that they can easily add that and after that they have to deal with the cache invalidation problem. ;) Besides the V1 SDK becomes deprecated sooner or later thanks for the new https://github.com/apigee/apigee-client-php.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants