-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
key不存在时,get方法返回值是false感觉不合适 #45
Comments
@danvinhe 那如果业务本身需要,存的value为null呢? |
@Neeke 是的,这个比较惆怅。我们的解决方案是存以前把$value,变成array($value) |
@Neeke null本身就是未知, 你自己都不知道, 你还设置啥. key不存在, 返回null应该是正确的. |
我觉得这种情况应该就不需要使用这种方式缓存了 |
有在线上跑的么? |
@laruence 我也觉得这样比较好,一般PHP框架数据库ORM返回值的时候,如果不存在就返回null |
返回false没有问题,比如yii2的缓存接口就是返回false:http://www.yiichina.com/doc/guide/2.0/caching-data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如果业务本身需要,存的value为false时,很容易混淆。不知道是不存在这个key,还是key的值就是false。两点建议:
The text was updated successfully, but these errors were encountered: