Shiva Profile picture
Mar 10 ā€¢ 11 tweets ā€¢ 4 min read
Excited to teach Redis core concepts in the next few days! šŸ§µ #Redis #thread šŸ‘‡ Image
Redis: Open-source, highly-replicated, performant, non-relational, database & caching server. Maps keys to values with the predefined data model. Data stored in-memory data store, It is good for caching, message brokers & streaming engines
Let's start with the string data structure
String: Store and retrieve a string, serialized json, numerical values, and binary data


MSET & MGET to assign and retreive multiple key valye in single command

Below e.g you can try in redis-cli Image
To increment a value by 1 or n can be done using `INCR KEY` and `INCRBY KEY NUM` Image
Similarly to decrement a value by 1 or n can be done using `DECR KEY` and `DECRBY KEY NUM` Image
You can `APPEND` the value to the existing data. Notice the integer is converted to a string. Use it carefully Image
Did you know you can store JSON data in Redis as strings? It's easy!
To know the length of a string use `STRLEN <KEY>` Image
Now we know how to store and retrieve data, what if you want to delete data. It's simple Image
`EX` will cause the data to expire in n seconds. This is great When you want to store data that are time sensitive
`TTL`: To check how much time is left before the data is destroyed Image
Thanks for reading this thread! If you're interested in learning more about Redis, follow me @_rshiva & don't forget to retweet the 1st thread to help other devs.
I'm passionate about #buildinginpublic,
web development, &
sharing my learnings with others.
Stay tuned for more
Note: Single redis string can store a maximum of 512 MB of data

ā€¢ ā€¢ ā€¢

Missing some Tweet in this thread? You can try to force a refresh

Keep Current with Shiva

Shiva Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!


Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @_rshiva

Mar 13
Redis Series Part 4 thread is here!
Today, we're diving into Redis `Hashes`, simple explanations, and real-world example
#redis #series #thread šŸ§µ
If you haven't read the previous thread about the list, check it out
Hash is essentially a collection of field-value pairs, where each field is a unique identifier and each value is the associated data. Just like JSON object or python dictionary. Everything inside the hash is a string.
In this example, we gonna store the user preferences when they want to receive threadletters in
HSET: command adds one or more fields-values to key
HSET <KEY> field1 value1 field2 value2 Image
Read 11 tweets
Mar 12
Redis Part 3 is here! Today, we'll be exploring the power of Redis 'Sets'. #redis #thread šŸ§µ
If you haven't read the previous thread about the list, check it out
Redis Sets are a unique way to store your data! They allow for an unordered collection of strings with no duplicates. Perfect for managing sets of items without worrying about repetition
Let's dive in with an example, Say we want to give one lucky user a year of free membership to Nooli. With Redis Sets, users can enroll in the giveaway but only once, preventing duplicates. Easy and efficient!
Read 12 tweets
Mar 11
Today, we will be learning about Redis' second data structure, which is the `list`. #thread šŸ§µ
If you haven't read the first thread, check it out
`List`: are like an array but we can use the list as a stack that follows Last-In-First-Out(LIFO) principle and a queue that follows First-In-First-Out (FIFO) principle
In this example, we gonna add users to our beta_list to send invitations in the near future

In the list, we use the push command, and to remove an item, we use the pop command. However, it's important to note that there are different types of push and pop commands available
Read 12 tweets
Mar 9
Want to level up your Rails skills? Check out this thread on string manipulation tips! šŸ§µ
#rubyonrails #rails
CamelCase: It converts the first and second letters of each word to uppercase. Great for words with underscores Image
dasherize: Replace underscore with a hyphen Image
Read 10 tweets
Apr 5, 2022
Super charged Plain Old Ruby Object(PORO) with Active Model.
Simple Car class which does not inherit from the active record. Cannot create a new object by with a hash of attributes Image
ActiveModel::Attributes You can assign a hash of attributes to the new method, initialize method takes an
arguments then call the assign_attributes on our car object with that hash Image
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!

This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!


0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy


3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!