I have one strange issue while using Memcached with Laravel. On my local environment I'm using Windows and because there is no Memcached for Windows I use the file cache driver locally. For the production server, we have Memcached installed and I use different config there and use the Memcached driver. The code is the same. Here is my issue with Memcached. Here is one simple code:
$cacheKey = "test_key";
$hasCache = Cache::has($cacheKey);
$value = "";
if($hasCache)
{
$value = Cache::get($cacheKey);
}
$isAdded = Cache::add($cacheKey, "test_value", 60);
$isAdded is always true (it should be true only the first time), so the cache is added, but $hasCache is always false and $value is always empty. It's like the value is deleted right after it is added to the cache
Locally it works fine, the issue appears only on the production server. There are no exceptions thrown. I'm having hard time debugging this, so if anyone had similar issue, I'd appreciate the help :)
Thanks, Andrej
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community