Monday, July 1, 2019

One of the tingly bits about saving the instance of a Class is serializing. For those who don’t know what the hell is this, the concept is very simple: you can represent an instance of a class as a string, so you can store anywhere, and then restore the instance from that same string. This is very useful to storing instances for later retrieval, like inside files, databases, in memory stores (like redis or memcached), or just anything that accepts text. For example, saving a User class instance with its properties into a Session, so after this is retrieved in the next request we can restore the same User instance without having to pull it out from the Database. Hey, it just an example.