IndeXus. Net Shared Cache-high-performance, distributed Cache Solution

Source: Internet
Author: User

I. Introduction

IndeXus. Net SharedCache is a high-performance, distributed memory object system. It is used to reduce database responsibilities in dynamic WEB or Win applications and improve access speed.

All SharedCache code is written in c #, And the 100% DotNet is original.

Let's take a look at several SharedCache methods:

1. Distributed Caching-partitioned

2. Replicated Caching

3. Single Instance Caching

 

Ii. Test the knife

1. Server

All source code can be downloaded from the SharedCache project website (http://www.codeplex.com/SharedCache.

There are 7 projects in the solution

You can open the compilation directly in vs2008.

However, ICSharpCode. SharpZipLib. dll is missing from the compressed package. Prepare this before compilation.

Files in the MergeSystem. Indexus. WinService "bin" Debug directory after compilation

Job_install.bat/job_uninstall.bat install/uninstall windows Services

Job_startService.bat/job_stopService.bat enable/stop the service

Job_Console.bat loads the service in the console.

Configuration in consumer. config ),

2. Test Procedures

Create a console program and add references to MergeSystem. Indexus. WinServiceCommon. The test code is as follows:

 

Using System;
Using MergeSystem. Indexus. WinServiceCommon. Provider. Cache;

Namespace ConsoleApplication1
{
Class Program
{
Static void Main (string [] args)
{
User [] data = new [] {new User {Name = "user1", Age = 20 },
New User {Name = "user2", Age = 1 },
New User {Name = "user3", Age = 22}
};

Foreach (var item in data)
{
IndexusDistributionCache. SharedCache. Add (item. Name, item );
}

Console. WriteLine ("count = {0}", IndexusDistributionCache. SharedCache. Count );

User user = IndexusDistributionCache. SharedCache. Get <User> ("user2 ");

Console. WriteLine ("name = {0}, age = {1}", user. Name, user. Age );

Console. WriteLine ("press any key to exit .");
Console. ReadKey ();
}
}

[Serializable]
Public class User
{
Public string Name {get; set ;}
Public int Age {get; set ;}

}
}

Configuration in App. config

<? Xml version = "1.0" encoding = "UTF-8"?>
<Configuration>
<ConfigSections>
<Section name = "indexusNetSharedCache" type = "MergeSystem. Indexus. WinServiceCommon. Configuration. Client. IndexusProviderSection, MergeSystem. Indexus. WinServiceCommon"/>

</ConfigSections>

<IndexusNetSharedCache defaultProvider = "IndexusSharedCacheProvider">
<Servers>
<Add key = "SrvZh03" ipaddress = "127.0.0.1" port = "48888"/>
</Servers>
<Providers>
<Add
Name = "IndexusSharedCacheProvider"
Type = "MergeSystem. Indexus. WinServiceCommon. Provider. Cache. IndexusSharedCacheProvider, MergeSystem. Indexus. WinServiceCommon"
>
</Add>
</Providers>
</IndexusNetSharedCache>
</Configuration>

Test program running result

Server Response:

Note that the cached object must be Serializable)

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.