代码之家  ›  专栏  ›  技术社区  ›  Patrik Svensson Martin Ender

无法将对象添加到Velocity缓存

  •  1
  • Patrik Svensson Martin Ender  · 技术社区  · 16 年前

    我刚刚安装 Velocity 在我的电脑上,除了我无法向缓存中添加任何对象外,一切似乎都很正常。检索缓存本身没有问题,但当我尝试添加一个对象时,所有内容都会冻结五分钟,然后我会超时。

    连接到缓存主机的代码(工作正常):

    // Define Array for 1 cache host.
    ServerEndPoint[] servers = new ServerEndPoint[1];
    
    // Specify Cache Host Details 
    servers[0] = new ServerEndPoint(
           "COMPUTERNAME" /* Host  */, 
           22233 /* Port */, 
           "DistributedCacheService" /* Service name */);
    
    // Pass configuration settings to CacheFactory constructor.
    m_cacheFactory = new CacheFactory(servers, 
           true /* Use routing client */, 
           false /* No local cache */);
    
    // Get the cache (works fine).
    Cache cache = m_cacheFactory.GetCache("MyCache");
    

    我向缓存中添加对象的代码(不起作用):

    // Get the cache.
    Cache cache = m_cacheFactory.GetCache("MyCache");
    
    // Create the item to put in the cache.
    Product product = new Product();
    product.Sku = "10000";
    product.Name = "My Product";
    
    // Put the object in the cache (The add method doesn't work either).
    cache.Put(product.Sku /* Key */, product /* Value */);
    

    通过集群管理员界面,我已经验证了缓存主机正在运行,并且缓存本身存在。

    有人知道问题是什么吗?

    编辑:

    我将日志接收器提供程序连接到缓存工厂,并验证了是否存在某种超时。缓存主机在我的本地计算机上,防火墙已关闭。

    CASClient-尝试交谈时超时 向 网。tcp://l1441gbg:22233/distributedcacheservice,速度。DRM。发送接收,警告,2008-11-20 11:06:29.988

    1 回复  |  直到 15 年前
        1
  •  2
  •   Andrea Colaci Andrea Colaci    16 年前

    您是否创建了带有Secondaries选项的namedCache“myCache”?我在使用单个服务器集群并使用-Secondaries 1选项创建NamedCache时也遇到了同样的冻结问题。主服务器似乎无法复制您要放入缓存的对象。 尝试删除命名的chache,并使用-seconomics 0选项重新创建它。