Skip to content

Commit e3b9daf

Browse files
committed
make it easier to customize the cache lookup in the TemplateLocator
1 parent 30b968b commit e3b9daf

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Templating/Loader/TemplateLocator.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ public function __construct(FileLocatorInterface $locator, $cacheDir = null)
4040
$this->locator = $locator;
4141
}
4242

43+
/**
44+
* Returns a full path for a given file.
45+
*
46+
* @param TemplateReferenceInterface $template A template
47+
*
48+
* @return string The full path for the file
49+
*/
50+
protected function getCacheKey($template)
51+
{
52+
return $template->getLogicalName();
53+
}
54+
4355
/**
4456
* Returns a full path for a given file.
4557
*
@@ -58,7 +70,7 @@ public function locate($template, $currentPath = null, $first = true)
5870
throw new \InvalidArgumentException("The template must be an instance of TemplateReferenceInterface.");
5971
}
6072

61-
$key = $template->getLogicalName();
73+
$key = $this->getCacheKey($template);
6274

6375
if (isset($this->cache[$key])) {
6476
return $this->cache[$key];

0 commit comments

Comments
 (0)