ITPub博客

首页 > > > Memcached最大使用内存配置

Memcached最大使用内存配置

作者:zzzhangyi 时间:2019-09-20 13:58:06 0 删除 编辑

我是在Windows环境下安装Memcached

版本是1.2.6,安装的时候。我用的是memcached -d install -m 500

我是想把最大的可以使用内存设置为500M,但是不管我怎么设置。

在Windows下面好像永远只能是默认的64M

然后我也做了测试。发现不管怎么用,也都只能使用内存64M

不知道大家在Windows下面是怎么使用的大内存的?

 1 static void Main(string[] args)
 2         {
 3             MemcachedClient cacheClient = new MemcachedClient();
 4             long count = default(long);
 5             string val = "abceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefgabceefg";
 6             for (int i = 0; i < 5; i++) {
 7                 val = val + val;
 8             }
 9             long MaxKey = default(long);
10             if (cacheClient.Get("MaxKey") != null) MaxKey = cacheClient.Get<long>("MaxKey");
11             string key = "Key" + MaxKey.ToString();
12             while (cacheClient.Store(StoreMode.Add, key, MaxKey.ToString() + val, new TimeSpan(1, 0, 0)))
13             {
14                 string cacheVal = cacheClient.Get<string>(key);
15                 cacheClient.Store(StoreMode.Set, "MaxKey", count);
16                 MaxKey += 1;
17                 key = "Key" + MaxKey.ToString();
18                 Console.WriteLine(MaxKey.ToString());
19                 if ((MaxKey % 5000) == 0) Console.ReadKey();
20             }
21             Console.ReadKey();
22         }


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3598/viewspace-3130947/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-14

  • 博文量
    133
  • 访问量
    947