-
- Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
- bug report? yes
- feature request? no
- version: 2.5.6 (nette/caching)
Description
When trying to load cache by fallback in another fallback of load, script runs to infinity (maybe deadlock?)
Steps To Reproduce
public function runMethodWithCache() { $cachedValue1 = $this->cache->load('cached_value_1', function(& $dependencies) { $dependencies['expire'] = '+1 day'; $value = $this->runAnotherMethodWithCache(); return $value; }); } private function runAnotherMethodWithCache() { $usedValue = 'something'; $this->someValue = $this->cache->load('cached_value_2', function (& $dependencies) use ($usedValue) { $dependencies[Cache::ITEMS] = ['cached_value_1']; return $usedValue; }); return 'something another'; }
When I comment following lines from second method, script running as expected.
$this->someValue = $this->cache->load('cached_value_2', function (& $dependencies) use ($usedValue) { $dependencies[Cache::ITEMS] = ['cached_value_1']; return $usedValue; });
[UPDATE 1]: most probably, this is caused by cross dependency of Cache::ITEMS in second method, which is dependent on first one cache.
Idea
If subloading of cache is not possible, it should be inspect to avoid sub-loading of cache.
Metadata
Metadata
Assignees
Labels
No labels