Closed jakerator closed 5 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Same for me
In CacheManager.php line 119:
[Files] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F
I saw that multiple users has the same problem with this lib, and anyone has been able to fix it :(
In InstagramScraper.php, change
private static $instanceCache;
to
private static $instanceCache = null;
Then, in public static function withCredentials()
, change:
static::$instanceCache = CacheManager::getInstance('files');
to
if (static::$instanceCache == null) {
static::$instanceCache = CacheManager::getInstance('files');
}
@adgray worked! thanks!
Just one thing, is not InstagramScraper.php file, is Instagram.php
vendor/raiym/instagram-php-scraper/src/Instagram.php
Why this was never fixed?
When calling getPaginateMediasByTag too often (4-5 times a minute), I'm getting this error:
"[ErrorException] [Files] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F "
Is this some config issue? How to fix it?