You are viewing our old blog site. For latest posts, please visit us at the new space. Follow our publication there to stay updated with tech articles, tutorials, events & more.

ncCache – Browser caching made easy

0.00 avg. rating (0% score) - 0 votes
The new messiah of client side storage, called Local Storage has made lives of front-end developers very easy. The credit certainly goes to HTML5. But wait, one cannot just implement Local Storage blindly. It doesn’t support all the browsers. Nor does it provide any support to manage quite a large amount of data without throwing errors. This really doesn’t sound very good and also makes it difficult to be implemented practically.

What led to the origin of ncCache at Naukri
Off lately, revamp of Naukri Recruiter Section went live. It feels good to tell you about this! The project required saving a lot amount of data. Had we been saving it in the DB, it would have increased server hits considerably and also the disk space usage. We analyzed that not all of the data was required to be saved in DB, a lot of it could be saved on client-side itself. So, we thought of using Local Storage, but what about the issues related to it?
We came across an awesome pre-built local storage plugin which was taking care of a lot of issues but unfortunately, not all that we required. So we built a wrapper over it and it’s called ncCache.
ncCache not only supports Local Storage on those browsers which themselves don’t support Local storage, but also allows you play around with LRU and TTL of a Local Storage key.
What does ncCache do?
  • Supports even those browsers which don’t have Local Storage object.
  • Expiration
Using ncCache, you can define expiration time for any key in Local Storage object. This will be the TTL (Time to Live) for that key.
Using this feature, you can save data in Local Storage:
    • Relatively: You can decide the time period to expire the Local Storage
    • Absolutely: You can set the time at which your Local Storage should get expired.
  • Priority
ncCache allows you to set cache priority as
    • Low : 1
    • Normal : 2
    • High : 3
On the basis of this, ncCache purges the key with lowest priority first. This default feature of removing Least Recent Used (LRU) cache, ensures that your browser doesn’t yells out ‘storage full errors’.
The Impact
When ncCache was implemented to solve our problem, we ended up reducing server look ups to approximately around 10 Lakhs per day. ncCache, when implemented with Naukri Suggestor, had saved around 15 Lakhs(approx.) HTTP lookups to the server in a day.
We still have a lot more in our pipelines which will include ncCache usage and further enhancements to it and you will soon get to hear from us on them.
You too can give it a try by downloading ncCache from