Example #1
0
        private static QueryCache LoadCache()
        {
            string type  = AppSetting.Default["App.CacheType"];
            string cache = AppSetting.Default["App.Cache"];

            if (string.IsNullOrWhiteSpace(type))
            {
                type = BuffaloCacheTypes.Web;
            }
            return(CacheUnit.CreateCache(type, cache));
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //INetFwPolicy2 firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
            //INetFwRule2 firewallRule = null;

            //firewallRule = firewallPolicy.Rules.Item("Bonjour 服务") as INetFwRule2;
            QueryCache cache = CacheUnit.CreateCache(BuffaloCacheTypes.Redis, "server=39.108.125.58:6379;throw=1;");
            string     key   = "App.BkIP";

            cache.SetValue <long>(key, 100);
            object cnt = cache.GetValue(key);
        }