Skip to content

Update the cache key by including namespace #38

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

Merged
merged 1 commit into from
Apr 10, 2019
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
24 changes: 12 additions & 12 deletions src/Mappers/GlobTypeMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,14 @@ private function storeTypeInCache(string $typeClassName, Type $type, string $typ
{
$objectClassName = $type->getClass();
$this->mapClassToTypeArray[$objectClassName] = $typeClassName;
$this->cache->set('globTypeMapperByClass_'.str_replace('\\', '_', $objectClassName), [
$this->cache->set('globTypeMapperByClass_'.str_replace('\\', '_', $this->namespace).'_'.str_replace('\\', '_', $objectClassName), [
'filemtime' => filemtime($typeFileName),
'fileName' => $typeFileName,
'typeClass' => $typeClassName
], $this->mapTtl);
$typeName = $this->namingStrategy->getOutputTypeName($typeClassName, $type);
$this->mapNameToType[$typeName] = $typeClassName;
$this->cache->set('globTypeMapperByName_'.$typeName, [
$this->cache->set('globTypeMapperByName_'.str_replace('\\', '_', $this->namespace).'_'.$typeName, [
'filemtime' => filemtime($typeFileName),
'fileName' => $typeFileName,
'typeClass' => $typeClassName
Expand All @@ -406,13 +406,13 @@ private function storeInputTypeInCache(ReflectionMethod $refMethod, string $inpu
{
$refArray = [$refMethod->getDeclaringClass()->getName(), $refMethod->getName()];
$this->mapClassToFactory[$className] = $refArray;
$this->cache->set('globInputTypeMapperByClass_'.str_replace('\\', '_', $className), [
$this->cache->set('globInputTypeMapperByClass_'.str_replace('\\', '_', $this->namespace).'_'.str_replace('\\', '_', $className), [
'filemtime' => filemtime($fileName),
'fileName' => $fileName,
'factory' => $refArray
], $this->mapTtl);
$this->mapInputNameToFactory[$inputName] = $refArray;
$this->cache->set('globInputTypeMapperByName_'.$inputName, [
$this->cache->set('globInputTypeMapperByName_'.str_replace('\\', '_', $this->namespace).'_'.$inputName, [
'filemtime' => filemtime($fileName),
'fileName' => $fileName,
'factory' => $refArray
Expand All @@ -427,7 +427,7 @@ private function storeExtendTypeMapperByClassInCache(string $extendTypeClassName
{
$objectClassName = $extendType->getClass();
$this->mapClassToExtendTypeArray[$objectClassName][$extendTypeClassName] = $extendTypeClassName;
$this->cache->set('globExtendTypeMapperByClass_'.str_replace('\\', '_', $objectClassName), [
$this->cache->set('globExtendTypeMapperByClass_'.str_replace('\\', '_', $this->namespace).'_'.str_replace('\\', '_', $objectClassName), [
'filemtime' => filemtime($typeFileName),
'fileName' => $typeFileName,
'extendTypeClasses' => $this->mapClassToExtendTypeArray[$objectClassName]
Expand All @@ -443,7 +443,7 @@ private function storeExtendTypeMapperByNameInCache(string $extendTypeClassName,
$typeName = $targetType->name;

$this->mapNameToExtendType[$typeName][$extendTypeClassName] = $extendTypeClassName;
$this->cache->set('globExtendTypeMapperByName_'.$typeName, [
$this->cache->set('globExtendTypeMapperByName_'.str_replace('\\', '_', $this->namespace).'_'.$typeName, [
'filemtime' => filemtime($typeFileName),
'fileName' => $typeFileName,
'extendTypeClasses' => $this->mapNameToExtendType[$typeName]
Expand All @@ -457,7 +457,7 @@ private function getTypeFromCacheByObjectClass(string $className): ?string
}

// Let's try from the cache
$item = $this->cache->get('globTypeMapperByClass_'.str_replace('\\', '_', $className));
$item = $this->cache->get('globTypeMapperByClass_'.str_replace('\\', '_', $this->namespace).'_'.str_replace('\\', '_', $className));
if ($item !== null) {
[
'filemtime' => $filemtime,
Expand All @@ -482,7 +482,7 @@ private function getTypeFromCacheByGraphQLTypeName(string $graphqlTypeName): ?st
}

// Let's try from the cache
$item = $this->cache->get('globTypeMapperByName_'.$graphqlTypeName);
$item = $this->cache->get('globTypeMapperByName_'.str_replace('\\', '_', $this->namespace).'_'.$graphqlTypeName);
if ($item !== null) {
[
'filemtime' => $filemtime,
Expand Down Expand Up @@ -510,7 +510,7 @@ private function getFactoryFromCacheByObjectClass(string $className): ?array
}

// Let's try from the cache
$item = $this->cache->get('globInputTypeMapperByClass_'.str_replace('\\', '_', $className));
$item = $this->cache->get('globInputTypeMapperByClass_'.str_replace('\\', '_', $this->namespace).'_'.str_replace('\\', '_', $className));
if ($item !== null) {
[
'filemtime' => $filemtime,
Expand Down Expand Up @@ -539,7 +539,7 @@ private function getExtendTypesFromCacheByObjectClass(string $className): ?array
}

// Let's try from the cache
$item = $this->cache->get('globExtendTypeMapperByClass_'.str_replace('\\', '_', $className));
$item = $this->cache->get('globExtendTypeMapperByClass_'.str_replace('\\', '_', $this->namespace).'_'.str_replace('\\', '_', $className));
if ($item !== null) {
[
'filemtime' => $filemtime,
Expand Down Expand Up @@ -568,7 +568,7 @@ private function getExtendTypesFromCacheByGraphQLTypeName(string $graphqlTypeNam
}

// Let's try from the cache
$item = $this->cache->get('globExtendTypeMapperByName_'.$graphqlTypeName);
$item = $this->cache->get('globExtendTypeMapperByName_'.str_replace('\\', '_', $this->namespace).'_'.$graphqlTypeName);
if ($item !== null) {
[
'filemtime' => $filemtime,
Expand Down Expand Up @@ -596,7 +596,7 @@ private function getFactoryFromCacheByGraphQLInputTypeName(string $graphqlTypeNa
}

// Let's try from the cache
$item = $this->cache->get('globInputTypeMapperByName_'.$graphqlTypeName);
$item = $this->cache->get('globInputTypeMapperByName_'.str_replace('\\', '_', $this->namespace).'_'.$graphqlTypeName);
if ($item !== null) {
[
'filemtime' => $filemtime,
Expand Down
2 changes: 1 addition & 1 deletion src/Types/TypeAnnotatedObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function createFromAnnotatedClass(string $typeName, string $classN
$fields = $fieldProvider->getSelfFields($className);
}
if ($parentType !== null) {
$fields = $parentType->getFields() + $fields;
$fields += $parentType->getFields();
}
return $fields;
},
Expand Down