Quickly build big data cache

Source: Internet
Author: User

Scenario:

After the system runs in the formal environment, it finds out that OOM (outofmemory) often occurs. After using windbg dump a few memories, it finds that many cache objects cannot be recycled. [a new description of the analysis process ], so how to handle the cache?

 

Solution:

Because the cache in the system uses hashtable to directly create keys and values to cache objects, which belongs to the strong handle type, of course, the first reaction is to create weakreference. So we re-constructed the cache based on this idea.

 

Ideas:

The cache base class bigcacheitem is based on weakreference. Other classes implement cache in different scenarios.

Class Name

Purpose

Bigfastcacheitem

Quick cache of big data to reduce the waiting time for object Creation

Fscacheitem

File Cache. When a large object cannot be cached in the memory, it can be cached as a file. If necessary, the data can be retrieved again.

Lightcacheitem

Lightweight cache: This type is recommended when objects can be easily created.

 

Let's get started with the code.

[Note]: many comments in the Code are automatically generated using ghostdoc, which is not verified and cannot be accurate.

 

Download source code:

/Files/alonesword/alonesword.component.cache.rar

Complete File Download:

Http://docs.google.com/View? Id = djsssq3_69gkvbmtcp

Related Article

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.