You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
first of all I want to thank you for the phpFastCache. I am making a decision what kind of cacheing framework to use with php and yours looks very intuitive and robust.
Nevertheless I did some local testing, mainly with the 'files' driver and I got some failures.
My testing code:
<?php
require 'vendor/autoload.php';
use phpFastCache\CacheManager;
$fileCache = CacheManager::getInstance('files');
$key = "product_page";
$cachedItem = $fileCache->getItem($key);
// there should be nothing in the cache.
echo '<br/>';
echo 'Stats size: ' . $fileCache->getStats()->getSize();
echo '<br/>';
echo 'Stats data: '. $fileCache->getStats()->getData();
echo '<br/>';
echo 'CachedItem key: ' . $cachedItem->getKey();
echo '<br/>';
echo 'CachedItem->get: ' . $cachedItem->get();
echo '<br/><br/>';
// cache some value
$cachedItem->set("Some cached value");
$fileCache->save($cachedItem);
$fileCache->commit();
echo 'Stats size: ' . $fileCache->getStats()->getSize();
echo '<br/>';
echo 'Stats data: '. $fileCache->getStats()->getData();
echo '<br/>';
echo 'CachedItem key: ' . $cachedItem->getKey();
echo '<br/>';
echo 'CachedItem->get: ' . $cachedItem->get();
echo '<br/><br/>';
// cache other value with the same key -> update
$cachedItem->set("OTHER cached value");
$fileCache->save($cachedItem);
$fileCache->commit();
echo 'Stats size: ' . $fileCache->getStats()->getSize();
echo '<br/>';
echo 'Stats data: '. $fileCache->getStats()->getData();
echo '<br/>';
echo 'CachedItem key: ' . $cachedItem->getKey();
echo '<br/>';
echo 'CachedItem->get: ' . $cachedItem->get();
// clear at the end.
$cleared = $fileCache->clear();
?>
When I load the page, everything seems to be OK. Anytime. But when I quickly hit the page at least 3 times(server is probabl trying to load from and clean the cache at the same time) I randomly got this failures. 1.
Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(C:\xampp\tmp\phpfastcache\localhost\files,C:\xampp\tmp\phpfastcache\localhost\files): System cant find specified path. (code: 3) in C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Util\Directory.php:56 Stack trace: #0 C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Util\Directory.php(56): RecursiveDirectoryIterator->__construct('C:\xampp\tmp\ph...') #1 C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Drivers\Files\Driver.php(235): phpFastCache\Util\Directory::getFileCount('C:\xampp\tmp\ph...') #2 C:\xampp\htdocs\Task\index.php(33): phpFastCache\Drivers\Files\Driver->getStats() #3 {main} thrown in C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Util\Directory.php on line 56
OR
2.
Fatal error: Uncaught phpFastCache\Exceptions\phpFastCacheDriverException: Can't read PATH:C:\xampp\tmp\phpfastcache\localhost\files in C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Drivers\Files\Driver.php:229 Stack trace: #0 C:\xampp\htdocs\Task\index.php(45): phpFastCache\Drivers\Files\Driver->getStats() #1 {main} thrown in C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Drivers\Files\Driver.php on line 229
It comes the file synchronisation issue to my mind as the possible root cause of that random issue.
I've found this article with my quick investigation. I tried to wrap it with iterator_to_array() but without a change.
What do you think?
Thanks.
Milos
The text was updated successfully, but these errors were encountered:
You may forgot to specify the TTL:
$cachedItem->set("OTHER cached value")->expireAfter(300);
Another possible case is that your server make use of "Delayed write" which can be the cause of this issue.
I tried your code i cannot reproduce the issue for now.
Hi,
first of all I want to thank you for the phpFastCache. I am making a decision what kind of cacheing framework to use with php and yours looks very intuitive and robust.
Nevertheless I did some local testing, mainly with the 'files' driver and I got some failures.
My testing code:
When I load the page, everything seems to be OK. Anytime. But when I quickly hit the page at least 3 times(server is probabl trying to load from and clean the cache at the same time) I randomly got this failures.
1.
Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(C:\xampp\tmp\phpfastcache\localhost\files,C:\xampp\tmp\phpfastcache\localhost\files): System cant find specified path. (code: 3) in C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Util\Directory.php:56 Stack trace: #0 C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Util\Directory.php(56): RecursiveDirectoryIterator->__construct('C:\xampp\tmp\ph...') #1 C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Drivers\Files\Driver.php(235): phpFastCache\Util\Directory::getFileCount('C:\xampp\tmp\ph...') #2 C:\xampp\htdocs\Task\index.php(33): phpFastCache\Drivers\Files\Driver->getStats() #3 {main} thrown in C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Util\Directory.php on line 56
OR
2.
Fatal error: Uncaught phpFastCache\Exceptions\phpFastCacheDriverException: Can't read PATH:C:\xampp\tmp\phpfastcache\localhost\files in C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Drivers\Files\Driver.php:229 Stack trace: #0 C:\xampp\htdocs\Task\index.php(45): phpFastCache\Drivers\Files\Driver->getStats() #1 {main} thrown in C:\xampp\htdocs\Task\vendor\phpfastcache\phpfastcache\src\phpFastCache\Drivers\Files\Driver.php on line 229
It comes the file synchronisation issue to my mind as the possible root cause of that random issue.
I've found this article with my quick investigation. I tried to wrap it with iterator_to_array() but without a change.
What do you think?
Thanks.
Milos
The text was updated successfully, but these errors were encountered: