TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

JavaScript caching framework for client side caching in the browser

65 pointsby d0ugalabout 13 years ago

8 comments

btiplingabout 13 years ago
If you are caching private information you are going to have a bad time. The expiration feature is misleading. It will only run when the site with the library is loaded.<p>So if you're in a random internet café checking your email on a site that uses this library to cache your emails and then close the browser and leave all that private information, your email content, is cached on that browser. If a savvy enough person saw you on this site and knew what it did that individual could go to the browser and simply use Web Inspector, in the case of Chrome, and check out what was cached and read all of your cached emails.<p>There is no way for the client to know it's not a secure environment unless you ask the user. You also could delete the cache on log out, but what you can't do is delete the cache when the browser or tab closes, because then you don't have a cache at all. And more than likely most devs wont even think on this and just imagine that their cache will expire at some point.<p>Gmail solves this problem by requiring a per browser opt-in via, on Chrome at least, a browser extension for client side caching.<p>I haven't investigated to see if there's some way to use the HTML5 cache.appcache window.applicationCache to solve this problem. That actually has an expire.
评论 #3814277 未加载
gioeleabout 13 years ago
Cache management is hard to get right. Make sure the data you send is cacheable and let the browser manage it.<p>Browsers have complex mechanisms in place to deal with broken firewalls, high-latency links, non-conformant servers and proxy. Any client-side caching implementation is going to be slower and less complete than its browser counterpart.
评论 #3813927 未加载
评论 #3813988 未加载
huskyrabout 13 years ago
What does this library offer over just using localStorage without a library? The browser API is already really easy, and with no fallbacks for IE&#60;9 i don't really see any advantage in using this...
评论 #3813786 未加载
sbarreabout 13 years ago
Amplify.js has a caching store that supports localStorage and more, abstracting away the actual storage mechanism..<p><a href="http://amplifyjs.com/api/store/" rel="nofollow">http://amplifyjs.com/api/store/</a>
评论 #3814998 未加载
评论 #3815622 未加载
评论 #3813809 未加载
marcuswestinabout 13 years ago
Nice! Also relevant: localStorage wrapper for all browsers without using cookies or flash. <a href="https://github.com/marcuswestin/store.js" rel="nofollow">https://github.com/marcuswestin/store.js</a><p>Perhaps worth using under the hood for locache?
评论 #3813808 未加载
评论 #3813759 未加载
x5315about 13 years ago
Why doesn't this use the userData for IE 6/7? Given that those browsers are the least performant, wouldn't it make sense to ensure caching works on them?
评论 #3813859 未加载
评论 #3813825 未加载
ImDeliciousabout 13 years ago
I find the batch operations odd odd:<p>1. why have a different method for multiple values rather then check parameter type for the normal methods (e.g. if 'set' received an object or get received an array).<p>2. getMany returns an array instead of an object mapping key to value. Sure may be more efficient but less convenient to use.
评论 #3813830 未加载
评论 #3813815 未加载
ladon86about 13 years ago
Looks good! How is mobile browser support?
评论 #3816851 未加载
评论 #3813806 未加载