This project is read-only.

Update 1.4 --> 1.5
new improvement :
add extension query for custom function

make your extension from Lyra.Cache.Extension.IExtension,example:

CacheClient client = new CacheClient(new string[] { "net.tcp://localhost:48088//cache" }, Client.Enum.RAIM.Mode5);
Dictionary<string, string> extensions = new Dictionary<string, string>();
extensions.Add("findname",
@"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lyra.Cache.Extension;

namespace Lyra.Cache.Extension.Test
{
public class TestExtension:IExtension
{
public bool Filter(System.Data.DataRow row, string extensionValue)
{
return row[""Name""].ToString().StartsWith(extensionValue);
}
}
}"
);

client.Create("member", typeof(TestCacheItem), null, extensions);

//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 using extension
GetWithExtensionClientResult<TestCacheItem, GetWithExtensionServerResult> result = client.GetWithExtension<TestCacheItem>("member", "findname", "ka");

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

Comments

No comments yet.