Learn more about Redis with java example

Reading Time: 2 mins

If you are working on an application which has more interaction with real-time data and for modern businesses, performance is the key factor. Moreover, with this scenario your data won’t be stored in structured way which was formerly stored with RDBMS part and to make storage flexible and access the unstructured data faster and better way you need the NoSQL storage obviously.

This is not the only thing, but many factors are considered while designing modern era of business application where one need to decide the best tools/technology to fit in. What that can be? Yes, Redis can help with this scenario and you may read more related to this with my post Introduction to caching, Redis and certification.

It is also considered as basic things with database design, and developer should know about this. If you are interested to learn about basic stuff developer should know, check out at this post.

So, why not try a little bit hands on with Redis?

Okay.

So, let’s get started.

For hands on, you need to setup an environment, and you can setup by steps best explained on Redis quick start. You must read all the documentation mentioned in links of article linked to understand the basics of Redis, how it works. Courses on Redis university are the best! explore more about courses and certification here. Moreover, they are providing this for free!

Once your setup is done, let’s see how can we have practical part!

Redis server looks like the image shown in blog caption on command line.

I’ve taken a simple SET part here to demonstrate how it is easy to use using CLI and with any programming language to use for application.

redis-cli example of set

Below example is shown using java. To connect Java code with Redis, we need jedis library, you can download jar from any repository.

Java code example for redis

Output:
Catogry: Footware
Sub-Category: Shoes

Let’s check the output on client:

As you can see, keys are case sensitive, through java code we can set data to Redis and have any client connected to it to consume data. Here the data can be used by many consumers/clients and query efficiently for huge data set too! Isn’t it amazing thing to play around with? Checkout more about it on https://redis.io/

So that’s it from my side, I hope this sample would help you to start with Redis using java.


References:
Learn on : https://redis.io and https://university.redislabs.com/
Images : My system


Dear reader, a sincere review from you would encourage me to write even more 😉

Stay tuned. Happy Learning.

Thanks 🙂

0 0 votes
Article Rating
Subscribe
Notify of
guest
4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Param Magi
Param Magi
4 years ago

Thank you so much for this blog sir, it’s help me to learn more.. keep posted more things

trackback

[…] used at large scale and for distributed applications. I’ve written article on Redis and basic example, which again is used as different purposes like storage, caching technology.Storage could be used […]

trackback

[…] Wanna try online? visit http://try.redis.io/ Also they have good documentation https://redislabs.com/ Learn about Redis java example here. […]

4
0
Would love your thoughts, please comment.x
()
x