Hacker News new | ask | show | jobs
by tyingq 1748 days ago
Both the redis and memcached PHP apis return boolean false when their equivalent of get() is called and no such key exists.

Personally, I'd stick with that and raise an exception on network and similar types of errors. PHP also supports trigger_error() but there doesn't seem to be top level guidance on errors vs exceptions. Try/catch just seems more straightforward to me.

1 comments

This is exactly what I had in mind. I'll stick with it and add a catch exception.

Thanks for your feedback!