Cm_Cache_Backend_Redis icon indicating copy to clipboard operation
Cm_Cache_Backend_Redis copied to clipboard

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

Open kandy opened this issue 5 years ago • 5 comments

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

kandy avatar Jan 22 '20 19:01 kandy

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

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

colinmollenhour avatar Jan 23 '20 17:01 colinmollenhour

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

kandy avatar Jan 23 '20 17:01 kandy

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.

colinmollenhour avatar Jan 23 '20 18:01 colinmollenhour

What version of Redis?

Xon avatar Jan 24 '20 04:01 Xon

@xon redis_version:5.0.7

kandy avatar Jan 24 '20 04:01 kandy