首页 \ 问答 \ 客户端缓存C#(Clientside Caching C#)

客户端缓存C#(Clientside Caching C#)

我的wpf客户端在启动时从服务器加载了大量的常备数据。 所以,我想在客户端实现缓存策略。

我知道.NET框架中新的System.Runtime.Caching命名空间4.不幸的是,只有内存缓存。 我不希望在每次启动客户端时加载大量数据。 所以我正在寻找持久的客户端缓存。

你怎么看待这件事?

另一个想法是我使用OODB(如db4o或VelocityDB)进行客户端缓存。 这是一个坏主意吗? 我没有客户端缓存方面的经验。

感谢您的回答和建议。

亲切的问候,亲


My wpf client is loading a lot of standing data at startup from the server. So, I want to implement a caching strategy at client side.

I know about the new System.Runtime.Caching namespace in the .NET framework 4. Unfortunately, there is only a memory caching. I don't want to load the huge amount of data at each startup of the client. So I'm searching for a persistent client caching.

What do you think about it?

Another idea was I use an OODB (like db4o or VelocityDB) for client caching. Is this a bad idea? I haven't any experience in client caching.

Thanks for your answers and suggestions.

Kind regards, pro


原文:https://stackoverflow.com/questions/12702950
更新时间:2019-09-10 17:12

最满意答案

如何在客户端存储数据并不重要。 不过,我会考虑使用IsolatedStorage。 可能更难的是告诉缓存何时变为陈旧。 这实际上是System.Runtime.Caching所擅长的。 服务器数据是根本更改,还是仅在应用程序的新版本发生后更改? 如果数据仅在新版本之后发生更改,您可能希望将其作为资源包含在应用程序设置中。 如果没有,您必须有一些超时或信号告诉客户端是时候检查服务器上的更改数据了。 您是否已经考虑过延迟加载数据? 这样,延迟可能不会在应用程序启动时发生,并且不太明显,甚至可能您甚至不必将完整数据加载到客户端。

关于超时:在我们的应用程序中,我们有一个固定的超时,它在第一次加载时设置为每个引用列表,每次从缓存请求时,都会检查超时。 如果它已过期,则在返回列表之前透明地刷新缓存。 这是一种权衡,因为客户端的数据可能已经陈旧一段时间了。 我们接受这一点,因为它在我们的情况下并不重要,并且每个列表都负责自己,并且我们不需要中央注册表跟踪每个列表的状态以便从外部设置超时。


How you store the data on the client side doesn't matter very much. I'd look into IsolatedStorage for your purposes, though. What might be more difficult is to tell when the cache turns stale. This is actually what System.Runtime.Caching is good at. Does the server data change at all, or only after a new release of the application? If the data changes only after a new release, you might want to include it as resources into the application setup. If not, you'd have to have some timeout or signal which tells the client that it is time to check for changed data on the server. Have you already considered lazy loading of the data? That way, the delay would probably not occur all at application startup and would be less noticable, and probably you wouldn't even have to load the complete data into the client.

Regarding Timeouts: in our application, we have a fixed timeout which is set to each reference list when it is first loaded, and every time it is requested from the cache, that timeout is checked. If it has expired, the cache is transparently refreshed before the list is returned. This is a tradeoff, because the data on the client side could be stale for some time. We accept this, because it isn't critical in our case, and that way every list is responsible for itself and we don't need a central registry keeping track of each list's state in order to set the timeout from outside.

2012-10-03

相关问答

更多

C#缓存和异步请求(C# caching and async requests)

有什么理由让它保持异步吗? 那真的取决于你。 如果您确实需要利用能够扩展的异步操作,那么请保留它。 否则,如果不这样做,请使用同步API。 这完全取决于您以及您在代码库中实际使用的内容。 我理解你担心异步方法“一路走来”并且实际上改变你的整个代码库变成异步这一事实。 这就是为什么你应该这样做,只要它是值得的。 附注 - 您可以稍微修改您的代码以节省自己的异步状态机生成: private Task<List<stuff>> GetData() { return _appCache.GetAs ...

Gemfire CACHING PROXY(Gemfire CACHING PROXY)

当您拥有CACHING_PROXY区域时,理想情况下,您希望保持服务器上所有更改的最新状态。 在Geode / GemFire中实现这一目标的机制是Register Interest,它会将所有更新从服务器推送到客户端以获取部分/全部密钥。 要使用此功能,您必须: 1.在创建客户端时启用订阅 ClientCacheFactory ccf = new ClientCacheFactory(); ccf.setPoolSubscriptionEnabled(true); 2.注册对感兴趣的密钥的兴

在页面上多次引用单个图像文件会影响性能吗?(Does referring single image file many times on a page impacts performance?)

asp.net/c#是服务器端语言,它将在服务器上执行代码,然后它将发送给用户浏览器 和css是客户端,所以这将在客户端浏览器上执行其任务,所以使用类或id通过css引用img总是好主意,你也可以使用css sprites来减少服务器请求 您还可以利用IIS中的浏览器缓存,以便下次用户无需下载该图像 asp.net/c# is server side language it will execute code on server and then it will send to users br

C#库到本机C ++应用程序(C# library to native C++ application)

您必须注意将接口从C#库公开到C ++兼容层。 在我的头脑中,你可以做两件事: 在C#库之上创建一个C API(最好的方法是在库中添加C ++ / CLI层)。 为C#库创建一个COM接口,并通过COM对象使用该库。 You will have to take care to expose your interface from the C# library to a C++-compatible layer. Out of the top of my head, you could do tw

从C ++调用C#(Calling C# from C++)

最终我想调用VB6的C#代码,但我这样问这个问题,因为我不相信后面的方法是没有中间步骤的。 您可以将C#类注册为COM可见,然后直接从C ++或VB6调用它们。 有关详细信息,请参阅MSDN上的示例COM类以及互操作性 。 Ultimately I want to call C# code from VB6 but I ask the question this way because I don't believe the later way is possible without an in

求C#教程??

上CSDN上找,哪里的资源丰富啊 先申请一个账号啊,记得要有邮箱啊,他会发一个网址到你的邮箱,点击网址激活csdn账号 上面的C# 教程多的是,c#我想你推荐 “戏说面向对象程序设计C#版”“大话设计模式”

C#,WCF,何时重用客户端代理(C#, WCF, When to reuse a client side proxy)

您可以重用您的WCF客户端代理,这将使您的客户端应用程序更快,因为代理只会初始化一次。 You can reuse your WCF client proxy and that will make your client application faster, as proxy just will initialize once.

C#客户端应用程序与Web应用程序(C# client app vs. web app)

您是否考虑使用ClickOnce来部署您当前的应用程序作为创建基于Web的应用程序的替代方案? 这将会大大简化安装。 另一种选择是将此应用程序放在网络共享上,让用户从共享中运行。 Did you consider using ClickOnce to deploy your current app as an alternative for creating web based apps? This would ease the installation a lot. The other opti ...

相关文章

更多

最新问答

更多
  • URL中此字符串格式的重要性是什么?(What's the significance of this string format in URLs?)
  • 如何创建矢量图形,然后从中生成图标?(How to create vector graphics and then generate icons from them?)
  • 动态Jasper报告列(Dynamic Jasper Report Columns)
  • 如何替换LogoList中的子列表(how to replace sublist in LogoList)
  • 从SQL Server导出到Excel收到错误(Exporting to Excel from SQL Server getting error)
  • 遍历python中的对象(Traversing objects in python)
  • 使用Python消除文件中的冗余(Eliminate redundancies from a file using Python)
  • 用于编译导入的类的命令(Command to compile imported classes)
  • PHP:preg_replace使用反向引用替换缩写(PHP: preg_replace replace abbreviation using backreferences)
  • Gradle Eclipse获取编译问题(Gradle Eclipse getting compile issues)
  • 如何在windows phone 8.1 / Windows 8.1中为http客户端请求操作设置超时(How to set time out for http client request operation in windows phone 8.1/Windows 8.1)
  • 用于从移动应用程序的mysql服务器获取数据的PHP代码[关闭](PHP code to fetch data from mysql server for mobile app [closed])
  • TF30063:您无权访问 - Visual Studio Online(TF30063: You are not authorized to access - Visual Studio Online)
  • 以aspnetBoilerplate中的所有租户的主机管理员身份获取记录(Get records as host admin for all tenants in AspnetBoilerplate)
  • 通过UWSGI / NGINX将参数传递给Python Flask(Pass parameters to Python Flask via UWSGI / NGINX)
  • Vim不会将备份文件保存到正确的目录中(Vim won't save backup files into the correct directory)
  • Intellij无法运行Scala代码(Intellij not able to run Scala Code)
  • opengl的依赖关系(opengl dependencies)
  • 确定具有不同优先级的两个布局约束中的哪一个确定它们影响的维/锚的值(Determining which of two layout constraints with different priorities is determining the value of the dimension/anchor they affect)
  • 在Java中是否可以将对象完全转换为其基类型?(Is it possible in Java to turn an object fully into its base type?)
  • 如果陈述不起作用?(If statements not working?)
  • 如何重定向shell脚本输出从python脚本运行[重复](How to redirect shell script output ran from a python script [duplicate])
  • 重置后尝试访问指针(Trying to access pointer after resetting)
  • Postgres优化插入/读取(Postgres optimize for insert/read only)
  • 360观察者统一,纹理在顶部和底部出现翘曲(360 viewer in unity, texture appears warped in the top and bottom)
  • .net Rx:消息的有序批处理(.net Rx: in-order batch-processing of messages)
  • 查询在给定区域中包含全景图的商业场所的api?(Query places api for business venues in given area which contain panoramas?)
  • iOS7和jQuery mobile:面板在打开和关闭后变为空白(iOS7 and jQuery mobile: panel goes blank once opened and closed)
  • 从Geany内部运行应用程序的多个实例(Run multiple instances of an application from inside Geany)
  • 使用Yii2在邮件中嵌入图像时出错(Error when embed image in mail using Yii2)