Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function createPreExecuteRequest($annotation, UseCase $useCase, UseCaseRe
$request = $this->cacheProxyStrategyRequestBuilder
->create()
->withNamespaceId($this->getNamespaceId($annotation, $useCaseRequest))
->withId(md5(serialize($useCaseRequest)))
->withId($this->createCacheId($useCase, $useCaseRequest))
->withLifeTime($annotation->getLifetime())
->build();
break;
Expand Down Expand Up @@ -120,25 +120,17 @@ private function getNamespaceId(Cache $annotation, UseCaseRequest $useCaseReques
/**
* @return string
*/
private function getPreEventName(Event $annotation, UseCase $useCase)
private function createCacheId(UseCase $useCase, UseCaseRequest $useCaseRequest)
{
return 'use_case.pre.' . $this->getEventName($annotation, $useCase);
return md5(get_class($useCase) . serialize($useCaseRequest));
}

/**
* @return string
*/
private function getPostEventName(Event $annotation, UseCase $useCase)
{
return 'use_case.post.' . $this->getEventName($annotation, $useCase);
}

/**
* @return string
*/
private function getOnExceptionEventName(Event $annotation, UseCase $useCase)
private function getPreEventName(Event $annotation, UseCase $useCase)
{
return 'use_case.exception.' . $this->getEventName($annotation, $useCase);
return 'use_case.pre.' . $this->getEventName($annotation, $useCase);
}

/**
Expand Down Expand Up @@ -182,7 +174,7 @@ public function createPostExecuteRequest(
$request = $this->cacheProxyStrategyRequestBuilder
->create()
->withNamespaceId($this->getNamespaceId($annotation, $useCaseRequest))
->withId(md5(serialize($useCaseRequest)))
->withId($this->createCacheId($useCase, $useCaseRequest))
->withLifeTime($annotation->getLifetime())
->withData($useCaseResponse)
->build();
Expand All @@ -207,6 +199,14 @@ public function createPostExecuteRequest(
return $request;
}

/**
* @return string
*/
private function getPostEventName(Event $annotation, UseCase $useCase)
{
return 'use_case.post.' . $this->getEventName($annotation, $useCase);
}

/**
* @return ProxyStrategyRequest
*/
Expand Down Expand Up @@ -237,6 +237,14 @@ public function createOnExceptionRequest(
return $request;
}

/**
* @return string
*/
private function getOnExceptionEventName(Event $annotation, UseCase $useCase)
{
return 'use_case.exception.' . $this->getEventName($annotation, $useCase);
}

public function setCacheProxyStrategyRequestBuilder(
CacheProxyStrategyRequestBuilder $cacheProxyStrategyRequestBuilder
)
Expand Down