Skip to content
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

chore(cache): improve invalidation logic #45

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sidux
Copy link
Contributor

@sidux sidux commented Jul 8, 2024

  • add more tests
  • since tags now have the name of the property or the method added we need to check how to invalidate them all (drop redis database ?)
  • check possible edge cases with imbricated requests
  • add test to check key invalidation when manual tags change

@sidux sidux requested review from kletord and Shivoham July 8, 2024 10:33
@sidux sidux force-pushed the improve-cache-invalidation branch 2 times, most recently from 1df0ed1 to 3dfa67f Compare July 8, 2024 12:27
@sidux sidux force-pushed the improve-cache-invalidation branch from 3dfa67f to 4d8df97 Compare July 8, 2024 12:56
@sidux sidux force-pushed the improve-cache-invalidation branch 3 times, most recently from 1f0a28c to b8729a3 Compare July 8, 2024 14:55
Copy link

github-actions bot commented Jul 8, 2024

Issued by Coverage Checker:

private function normalizePrefixName(string $name): string
{
return str_replace(
['\\', 'SharedResponse', 'Embedded', '_Shared'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

needs tests

if (!$member->isPublic() || \count($member->getParameters()) > 0) {
throw new \LogicException(
sprintf(
'Method %s::%s must be public and have no parameters to be used as a tag.',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

needs test

if (!$member->isInitialized($object)) {
throw new \LogicException(
sprintf(
'Property %s::%s must be initialized to be used as a tag.',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

needs test

if ($response !== null && \is_object($response)) {
$prefix = $this->normalizePrefixName(\get_class($response));
} else {
$prefix = $this->normalizePrefixName(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

needs tests

foreach ($ref->getProperties() as $propRef) {
$subObject = $this->getPropertyValue($ref, $object, $propRef->getName());

$registeredTags = $this->guessObjectsTags($subObject, $prefix, $excludedClasses, $registeredTags);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there a possible embedded requests edge case ?

@sidux sidux force-pushed the improve-cache-invalidation branch from b8729a3 to 2d77187 Compare July 8, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant