This project is read-only.

Server Side :

1.Lyra.Cahce.Server is the core code and Lyra.Cache.Server.CmdHost is a Console application for support demo service.
2.Edting app.config for your apply
CacheLockSeconds : lock seconds for query transaction,if enable lock while query,the selected cache items will hiden for others querys utill auto-unlock.
TransferCompressSize : if query result content's length longer than this value,it will be compressed during transfer
CacheMemoryLimit : Max use Bytes Limit,default is 0,unlimited
CacheMemoryLackAction : When Lack Memory , the Server's Action : block(unable add untill some cache item expired) or release(auto release percentage cache item order by expire time)
CacheMemoryLackRelesePercentage : if CacheMemoryLackAction is release , auto release percentage

Client Side :

1.Lyra.Cache.Client is the Query Provider for Develop,example:

//create a class for cache contract
class TestCacheItem
    public string Name { get; set; }
    public int? Age { get; set; }
    public DateTime? Birth { get; set; }

//new a provider for operation,two cache server deployed,use Mode1 for RAIM
CacheClient client = new CacheClient(new string[]{net.tcp://localhost:48088//cache","net.tcp://localhost:48089//cache},RAIM.Mode1);
//create a region named 'member' for cache
client.Create("member", typeof(TestCacheItem));
//add two cache item into 'member'
client.Add("member", "lily", new TestCacheItem() { Name = "lily", Age = 30, Birth = DateTime.Now }, TimeSpan.FromMinutes(30));
client.Add("member", "kate", new TestCacheItem() { Name = "kate", Age = 25, Birth = DateTime.Now }, TimeSpan.FromMinutes(30));
//get use key
GetClientResult<TestCacheItem,GetServerResult> result = client.Get<TestCacheItem>("member", "lily");
if (result.HasError)
//get has some error,lookup for cache server's result
    foreach (KeyValuePair<string, GetServerResult> kvp in result.ServerResults)
        Console.WriteLine(string.Concat("server:", kvp.Key, " code:", kvp.Value.Code));

TestCacheItem resultitem = result.Object.Data;
//when the cache item cached
DateTime? resulttime = result.Object.Time;

//get use filter
GetWithFilterClientResult<TestCacheItem,GetWithFilterServerResult> results = client.GetWithFilter<TestCacheItem>("member", "Age < 28");
//get use lock and filter
string locksession = Guid.NewGuid().ToString("N");
GetWithFilterClientResult<TestCacheItem, GetWithFilterServerResult> resultlockeds = client.GetWithFilter<TestCacheItem>("member", "Age < 28", locksession, 30);
//remove for process
foreach (KeyValuePair<string, CacheObject<TestCacheItem>> kvp in resultlockeds.Objects)
    client.Remove("member", kvp.Key, locksession);

2.Lyra.Cache.HelperTool is a client for demo


Update 1.5 released 2013-03-07

    see for more info

Update 1.4 released 2013-02-15

    see for more info

Update 1.3 released 2013-01-28

    see for more info

Update 1.2 released 2013-01-26

    see for more info

Update 1.1 released 2013-01-25

    see for more info

HelperTool document : LyraCacheHelperTool User Guid 1.4.docx

Last edited Mar 7, 2013 at 3:04 AM by JosephZheng, version 14


No comments yet.