Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@
"Flagsmith\\": "src",
"FlagsmithTest\\": "tests"
}
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
}
3 changes: 2 additions & 1 deletion src/Flagsmith.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,9 @@ private function getIdentityFlagsFromApi(string $identifier, ?object $traits): F
{
try {
$data = IdentitiesGenerator::generateIdentitiesData($identifier, $traits);
$cacheKey = IdentitiesGenerator::generateIdentitiesCacheKey($identifier, $traits);
$apiFlags = $this->cachedCall(
'Global',
$cacheKey,
'POST',
$this->identities_url,
$data
Expand Down
6 changes: 6 additions & 0 deletions src/Utils/IdentitiesGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ public static function generateIdentitiesData(string $identifier, ?object $trait

return $identities;
}

public static function generateIdentitiesCacheKey(string $identifier, ?object $traits)
{
$hashedTraits = $traits !== null ? '.'.sha1(serialize($traits)) : '';
return 'Identity.'.$identifier.$hashedTraits;
}
}