Redis Command: HSET

Create a new hash and set fields, or change the existing value of field(s) of a hash. If the key does not exist then it will be created. If the field does not exist then it will be created. And if the field exists then the value will be overwritten.

Redis Command: RESTORE

Restore data from a serialized(by DUMP command) data. This command creates a key, unserializes the provided data, then stores the value for the key. The expiration time of the original key is not contained in the data, so that is not contained in the created key. RDB version and data checksum are checked before restoring data.

Redis Command: DUMP

Serialize the value of a key, in a specific format. We can use the serialize value to later recreate/restore the value. Redis command RESTORE can be used for the restoration. The encoding format is the same as the format used for the RDB file. RDB version is also added in the encoded value.

JavaScript: Event Capturing and Bubbling [event propagation in detail]

If you are designing some event-heavy component using JavaScript, then the propagation of the event becomes very critical. Any event like “click”, “hover” etc. has 2 ways of traveling through the components. To understand the capturing and bubbling, we need to understand the params of “addEventListener” method of EventTarget. Here is the signature of “addEventListener”.

Redis: Backup and Restore [full DB and single key]

Here are the processes to backup and restore data from and to the Redis server. Though the restore and back is not a frequently used process, but this becomes crucial in certain use cases. Also moving data from one Redis server to another is a very handy process when we need that. Here we have discussed 2 processes for the backup and restoration of the Redis server.

Redis Command: BLPOP

BLPOP extracts/pops an item from the Left/HEAD of the first non-empty list. This is a blocking operation, so if no item is available in the provided list, this command will wait.

Redis Command: LTRIM

Trim a Redis list, and remove items from the list from one or both end(s). We provide a starting and ending index for the trim and the items outside that window are removed. If all items are removed while trimming, then the list is deleted. Indexes are Zero(0) based.

JavaScript: “use strict” – [strict mode]

“use strict” directive enables a strict operating context/mode for the code. This helps us to identify potential exceptions and makes debugging easier. In strict mode, we are notified about code that would trigger some weird behavior or fail silently. To enable the strict mode for the whole script, add the string “use strict” at the top of the script.

Redis Command: LREM

Remove items from a list. We can provide a argument, in that case, the command will remove number of occurrences of the item. If all the items of the list are removed by this command, then the list is deleted.