<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[itpera - Medium]]></title>
        <description><![CDATA[It Articles - Medium]]></description>
        <link>https://medium.com/itpera?source=rss----db179f4deb11---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>itpera - Medium</title>
            <link>https://medium.com/itpera?source=rss----db179f4deb11---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 13:09:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/itpera" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introduction Cache( Redis + Nodejs) Tutorial]]></title>
            <link>https://medium.com/itpera/introduction-cache-redis-nodejs-tutorial-343bd9cefc2e?source=rss----db179f4deb11---4</link>
            <guid isPermaLink="false">https://medium.com/p/343bd9cefc2e</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Mehmet Fatih Durdu]]></dc:creator>
            <pubDate>Tue, 20 Aug 2019 10:53:35 GMT</pubDate>
            <atom:updated>2019-08-20T11:07:47.920Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*8fYFQkN0mSSyJ-l-DB0RTQ.png" /></figure><p>This article is simple introduction about Redis integration with Nodejs . We will learn how to works caching at Nodejs. Cache improve performance and speed at your project.</p><h3><strong>What Is Redis?</strong></h3><p>Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports various data structures such as Strings, Hashes, Lists, Sets etc. We will learn how to use as cache or database.</p><h3>Steps</h3><p>1-Create project folder</p><pre>mkdir redisnodejs<br>cd redisnodejs</pre><p>2-Create index.js</p><pre>For Windows<br>echo some-text  &gt; index.js</pre><pre>For Linux<br>touch index.js</pre><p>3-We need to install redis with npm</p><pre>npm install redis --save</pre><p>4-We can write that code below to index.js</p><pre>var redis = require(&#39;redis&#39;); //This is redis import</pre><pre>var client = redis.createClient(); //Creating redis client</pre><pre>//This code show error when we try to coneect redis</pre><pre>client.on(&#39;error&#39;, function (err) {</pre><pre>console.log(&#39;Something went wrong &#39;, err)</pre><pre>});<br></pre><pre>//This code push string value to redis</pre><pre>client.set(&#39;stringExample&#39;, &#39;text Emaple&#39;, redis.print);</pre><pre>//This code get value from redis</pre><pre>client.get(&#39;stringExample&#39;, function (err, result) {</pre><pre>console.log(result); // this is a string</pre><pre>});</pre><pre>//This object data caching at redis</pre><pre>var data = {</pre><pre>sampleTime: &#39;1450632410296&#39;,</pre><pre>data: &#39;76.36731:3.4651554:0.5665419&#39;</pre><pre>};</pre><pre>//This is set object data</pre><pre>client.set(&#39;data:id&#39;, JSON.stringify(data), redis.print);</pre><pre>//We get data by id and we will see data at log</pre><pre>client.get(&#39;data:id&#39;, function (err, result) {</pre><pre>console.log(JSON.parse(result)); // this is a string</pre><pre>});</pre><pre>//We can put data key and value</pre><pre>client.hset(&#39;HSET record&#39;, &#39;key&#39;, &#39;value&#39;, redis.print);</pre><pre>client.hset(&#39;HSET record&#39;, &#39;second key&#39;, &#39;second value&#39;, redis.print);</pre><pre>client.hgetall(&#39;HSET record&#39;, function (err, result) {</pre><pre>console.log(JSON.stringify(result)); // {&quot;key&quot;:&quot;value&quot;,&quot;second key&quot;:&quot;second value&quot;}</pre><pre>});</pre><p>See you in the next nodejs posts.</p><p>You can find the full code from this <a href="https://github.com/itpera/redisnodejs">link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=343bd9cefc2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/itpera/introduction-cache-redis-nodejs-tutorial-343bd9cefc2e">Introduction Cache( Redis + Nodejs) Tutorial</a> was originally published in <a href="https://medium.com/itpera">itpera</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>