Cache processing in a server Load balancer Environment

Source: Internet
Author: User


Learn more about Enterprise Library. net Framework 2.0 cache mechanism-analysis article, this article introduces a lot of caching content, I will not detail, I will mainly talk about the web farm environment of a recently developed cache module, that is, the way to process the cache in the Server Load balancer environment. The main idea is as follows: the cache Expiration Policy uses dependent files, that is, the cache items depend on files. If the cache changes, the dependent files are modified. Generally, the file date is modified.

Public void add (string key, object value, cacheitempriority scavengingpriority, inclurefreshaction, Params icacheitemexpiration [] expirations) of the. cachemanager object add method can be completed by using a common cache dependent file)

Icacheitemexpiration has a filedependency. icacheitemrefreshaction interface that can be used to implement cache dependent file changes, and re-obtain data after cache expiration to achieve cache synchronization for each server.
For example, primitivescache. Add (product. productid, product, enternewitemform. Priority, new productcacherefreshaction (), new filedependency ("\ server06 \ dependencyfile.txt "));

 

[Serializable]

Public class productcacherefreshaction: icacheitemrefreshaction

{

Public void refresh (string key, object expiredvalue, cacheitemremovedreason removalreason)

{

// Item has been removed from cache. Perform desired actions here, based

// The removal reason (e.g. Refresh the cache with the item ).

If (removalreason! = Cacheitemremovedreason. removed)

{

 

}

}

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.