-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Add serialized capacity to Cache_Redis for objects #3181
Conversation
Updated with Tcholakov's suggestion. Verified on Both Mac and Ubuntu environments and run correctly with my database result.
@@ -38,6 +38,11 @@ | |||
class CI_Cache_redis extends CI_Driver | |||
{ | |||
/** | |||
* A key-suffix for distinguishing serialized values. | |||
*/ | |||
const KEY_SUFFIX_FOR_SERIALIZATION = '_ci_driver_serialized'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this constant- Hardcode the string to '_ci_redis_serialized:'
On second thought ... it should be a constant, just give it a better name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have chosen this ugly suffix in order it not to be hit by a developer by accident. I am fine with '_ci_redis_serialized:' too. As I can see below, by this string you mean a prefix.
Overall, I see this as something rather hacky ... isn't there a way to separately mark the keys of serialized values? Like creating a list containing all serialized vars? Such a list would be easily read and cached during the library initialization and way easier to work with. |
Also, I got lost between all those PRs, just commit to one of them. |
Could I answer these questions? |
Sure, if you know the answers. |
I did not comment the obvious things "Add empty line.", etc. They are to be done. You figured out a third approach, this is interesting. Let me enumerate the possible ways:
Well, if you like the second approach, you may merge chonhan's contribution as it is now. I promise to polish it after that, according to your comments. |
Why would it look hackish? All you'll need to do is fetch that list during the library initialization and add to it in |
OK, I will try to implement the third approach, slowly, without rush. It makes sense. |
Just in case, before the next try I have polished the second idea by implementing the remarks by @narfbg. Here is the gist: https://gist.github.com/ivantcholakov/e1d889793e469315ec89 |
Implemented in #3186. |
Updated with Tcholakov's suggestion.
Verified on Both Mac and Ubuntu environments and run correctly with my database result.