TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Unshared or Private Caches for my app/company to use?

12 点作者 dedalus大约 3 年前
Cache-Control:private only states that shared caches (such as proxy caches) should not cache the response but any private cache can. Now my question is do folks know of any such private caches in use (commerical or open source) as I can sense a lot of webapps today can be made faster with an "unshared" or per user cache e.g cache with user specific keys and cookies such that its purely a per user cache. It sounds like something on the user's machine , correct?

5 条评论

toast0将近 3 年前
Every mainstream browser caches content locally in memory, on disk, or both. Cache-control: private suggests that storage in the browser cache is acceptable but that storage in proxy caches intended for multiple users is not.
评论 #31392917 未加载
keyle将近 3 年前
If you run an app like gmail for example, you can store most everything in cache, and local storage (browser), including logos, button graphics etc. Resulting to an app that loads almost instantly most of the time as it&#x27;s coming from disk (relatively speaking, many would argue that disk access is extremely slow).<p>This information stored should obviously not be time sensitive. But if you&#x27;re running a client for social networks or such, it&#x27;s perfectly a good idea to cache the last 10 posts seen for example, so that when the user loads the page, he instantly has something to look at while the browser is fetching the fresh content.<p>Local storage was designed for this I believe: a longer-life cache for unimportant data.<p>One key consideration is security: do not cache things on the browser that may be private or sensitive information, unless encrypted, but even then the argument could be made to not do it at all. That said, storing your application graphics and most of the UI bits in local storage can certainly improve the user experience greatly.
评论 #31393506 未加载
matt_heimer将近 3 年前
The best thing to do is just use the browser&#x27;s own cache but because of the cache partitioning mentioned in the article, host 3rd party libs on your own site instead of using traditional shared CDN URLs. By hosting yourself you can make sure each resource is at a version specific URL can you can crank the cache durations way up for all your CSS and JS files so you don&#x27;t even need to do cache validation often. You can even have a cache seeding page the loads every resource if you want. For HTML files make sure that your HTTP servers support last modified or etags so that If-None-Match or If-Modified-Since can be used.<p>Use a CDN accelerator like Cloudflare to improve load time since server side caching and client to server distance can impact performance.<p>Caching is solved fairly well by browsers, its usually server misconfiguration or lack of that is the problem.<p>I think <a href="http:&#x2F;&#x2F;www.squid-cache.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.squid-cache.org&#x2F;</a> has options to ignore some of the browsers cache headers and return cached content anyway. But HTTPS caching requires that you let the traffic be intercepted and install custom CA certs so the proxy can be a MITM caching proxy.
donavanm将近 3 年前
As others have said, make sure youre using the local cache first. Once youre beyond that most CDNs support advanced “cache keys”. Beyond the URL you can use (parts of) the query param, cookies, or headers to construct a cache key. You could get down to user&#x2F;group&#x2F;etc specific CDN caching with that approach. For an example: <a href="https:&#x2F;&#x2F;docs.aws.amazon.com&#x2F;AmazonCloudFront&#x2F;latest&#x2F;DeveloperGuide&#x2F;controlling-the-cache-key.html" rel="nofollow">https:&#x2F;&#x2F;docs.aws.amazon.com&#x2F;AmazonCloudFront&#x2F;latest&#x2F;Develope...</a>
评论 #31412159 未加载
warrenm将近 3 年前
There are <i>loads</i> of caching proxies available for private&#x2F;corporate use - I run Squid[0], personally...but have seen at least a dozen other tools in use in corp envs<p>------------<p>[0] <a href="https:&#x2F;&#x2F;antipaucity.com&#x2F;2018&#x2F;07&#x2F;18&#x2F;a-fairly-comprehensive-squid-configuration-for-proxying-all-the-http-things&#x2F;#.YoPdJWDMIrY" rel="nofollow">https:&#x2F;&#x2F;antipaucity.com&#x2F;2018&#x2F;07&#x2F;18&#x2F;a-fairly-comprehensive-sq...</a>
评论 #31563781 未加载