-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Should unmatched cache() return null? #1870
Comments
I guess, it should be null if no data found with associated key passed to maintain the consistency throughout the project |
Looking into this, it is a bit more complicated as each Cache handler has its own implementation of |
I don't know that there is a reason for it being different honestly. This and the session drivers were all ported over with very little changes, so I didn't analyze them much. I have no problem with them returning NULL, and that makes sense to make for consistency sake. Actually, NULL seems to make even more sense given that you could frequently store values of But I also don't know the different engines all that well, so would be researching as I went, also. |
Needing to store |
The cache Service accessory for the Caching Library is incredibly helpful and makes for seamless data sourcing among session, input, etc. However, that it doesn't mimic the other wrappers in returning "null" makes for cumbersome extra checks.
I wonder if there was an explicit reason for cache to return "false" (making it impossible to cache anything to 'false')? And if not would that be okay to change?
Ref: https://codeigniter4.github.io/CodeIgniter4/general/common_functions.html#cache
EDIT: wording
The text was updated successfully, but these errors were encountered: