Skip to content

Commit 5a97ad7

Browse files
author
pini-girit
committed
v1.14.9: Removed registry cache from transformation queries - needs improvments
1 parent 576d216 commit 5a97ad7

File tree

1 file changed

+4
-38
lines changed

1 file changed

+4
-38
lines changed

Model/Transformation.php

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313

1414
class Transformation extends AbstractModel
1515
{
16-
/**
17-
* @var string
18-
*/
19-
private $imageNameCacheKey;
20-
2116
private $configuration;
2217

2318
/**
@@ -79,27 +74,6 @@ public function getFreeTransformation()
7974
return $this->getData('free_transformation');
8075
}
8176

82-
/**
83-
* @method cacheResult
84-
* @param bool $result
85-
* @return mixed
86-
*/
87-
private function cacheResult($result)
88-
{
89-
$this->_registry->unregister($this->imageNameCacheKey);
90-
$this->_registry->register($this->imageNameCacheKey, $result);
91-
return $result;
92-
}
93-
94-
/**
95-
* @method cacheResult
96-
* @return mixed
97-
*/
98-
private function getFromCache()
99-
{
100-
return $this->_registry->registry($this->imageNameCacheKey);
101-
}
102-
10377
/**
10478
* @param string $imageFile
10579
* @return ImageTransformation
@@ -115,21 +89,13 @@ public function transformationForImage($imageFile)
11589
/**
11690
* @param ImageTransformation $transformation
11791
* @param string $imageFile
118-
* @param bool $refresh
11992
* @return ImageTransformation
12093
*/
121-
public function addFreeformTransformationForImage(ImageTransformation $transformation, $imageFile, $refresh = false)
94+
public function addFreeformTransformationForImage(ImageTransformation $transformation, $imageFile)
12295
{
123-
$this->imageNameCacheKey = 'cldtransformcachekey_' . (string) $imageFile;
124-
if (!$refresh && ($cacheResult = $this->getFromCache()) !== null) {
125-
if (($cacheResult->getImageName() === $imageFile) && $cacheResult->hasFreeTransformation()) {
126-
$transformation->withFreeform(Freeform::fromString($cacheResult->getFreeTransformation()));
127-
}
128-
} else {
129-
$this->load($imageFile);
130-
if (($this->getImageName() === $imageFile) && $this->hasFreeTransformation()) {
131-
$transformation->withFreeform(Freeform::fromString($this->getFreeTransformation()));
132-
}
96+
$this->load($imageFile);
97+
if (($this->getImageName() === $imageFile) && $this->hasFreeTransformation()) {
98+
$transformation->withFreeform(Freeform::fromString($this->getFreeTransformation()));
13399
}
134100

135101
return $transformation;

0 commit comments

Comments
 (0)