colinmollenhour/Cm_Cache_Backend_Redis

"save" produce PHP Notice if there is not free memory in Redis

kandy opened this issue · 5 comments

kandy commented

Steps:

  • I configure limited size of redis (40MB)
  • Redis php extension is not installed
  • I create a script and run
<?php
       $cache = new Cm_Cache_Backend_Redis([ ... ]);
       while (true) {
           $cache->save('data', "my_test_data" . $i++, ['tag1', 'tag2', 'tag3_'.$i ]);
       }

WIG:
PHP Notice: Undefined offset: 5 in /app/vendor/colinmollenhour/credis/Client.php on line 963
WIE:
save will return false or exception

On master line 963 is a comment.. Are you using the latest version?

https://github.com/colinmollenhour/credis/blob/master/Client.php#L963

kandy commented

I test on version 1.10.6 of colinmollenhour/cache-backend-redis package
On master, it will be https://github.com/colinmollenhour/credis/blob/master/Client.php#L991 line

Thanks. The answer is not obvious to me so this would require further investigation which I don't know when I'd be able to do. I'd be happy to review a PR if you can find the issue, or if you can at least provide a screenshot of a debugger at this step I might be able to help more.

Xon commented

What version of Redis?

kandy commented

@Xon
redis_version:5.0.7