zoukankan      html  css  js  c++  java
  • Using Cache Versus Application[ref]

    Using Cache Versus Application

    It might appear that there are close likenesses between the Cache and HttpApplicationState classes. Both have the capability to store data in an application-wide context, and the syntax for dealing with them is basically identical. The differences, however, are great.

    Both the Cache and HttpApplicationState classes provide a mechanism for storing application-wide data and can be used for managing state because of this. This is where the likenesses end.

    The Cache class takes management of this data further than that of the HttpApplicationClass.

    First, accessing data in the Cache class is fully thread-safe. This is unlike the HttpApplicationState class, which requires you to surround data access with synchronization methods Lock() and UnLock().

    Second, the Cache class, based on a prioritization scheme, can free data from the Cache when it has not been used in order to free up memory when resources are low.

    Also, you get more control over the items added to the Cache by setting absolute and sliding expiration policies.

    Last, you can associate items with the Cache to other cached items or to a file, which will result in the cached items being removed from the Cache.

    The HttpApplicationState class serves well as a general state store for information needing to be available application-wide and needing to exist during the life of the application.

    The Cache class is better suited for complex state management in which greater control over the cached data is required.

    ref:http://conferences.embarcadero.com/article/32217

  • 相关阅读:
    [PY3]——heap模块 和 堆排序
    [PY3]——求TopN/BtmN 和 排序问题的解决
    [转载+补充][PY3]——环境配置(2)——windows下安装pycharm并连接Linux的python环境
    [转载+补充]windows下SVN客户端的安装
    [Visual studio code 常见问题解决] ——中文乱码、
    Smrty模版总结(转)
    cms内容模型标签
    phpcms图文总结(转)
    phpcms总结(转)
    PHP总结
  • 原文地址:https://www.cnblogs.com/chinaniit/p/2270056.html
Copyright © 2011-2022 走看看