1

I am working on gallery related web application in react.I am trying to implement image cache in my application.I used local storage to store base64 string against image url.But the local storage limit is 5mb, Whenever i reach limit i am deleting images using LRU cache mechanism.I wanted to know is there any better approach.

code:

window.localstorage.setItem(url,base64 image string)

1 Answer 1

2

Why do you make life more complicated. By default the browser inspects the headers of the HTTP response generated by the web server. There are four headers commonly used for caching:

  • ETag
  • Cache-Control
  • Expires
  • Last-Modified

For more information about how it works please read https://medium.com/@codebyamir/a-web-developers-guide-to-browser-caching-cc41f3b73e7c

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.