Configuration amazon Memcached with Enyim.Caching

610 Views Asked by At

The method always returns false, and I do not know where the problem is:

  var myObj = new MyObj("Key01","My Value ");
  bool isInserted = memCache.Store(Enyim.Caching.Memcached.StoreMode.Add, myObj.Id, myObj.name , new     TimeSpan(0, 10, 0)); 

My File app.config: (pointing to Amazon ElastiCache)

<configuration>
  <configSections>
    <sectionGroup name="enyim.com">
      <section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" />
    </sectionGroup>

  </configSections>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
      </startup>
    <enyim.com>
  <memcached>
    <servers>
      <!-- put your own server(s) here-->
      <add address="memCashed.*****.0015.usw2.cache.amazonaws.com" port="11211" />
    </servers>
    <socketPool minPoolSize="100" maxPoolSize="1000" connectionTimeout="00:10:10" deadTimeout="00:02:00" />
  </memcached>
  </enyim.com>

</configuration>
1

There are 1 best solutions below

1
Anthony Neace On

By choosing the default security group, you will have prevented network access to your cache clusters unless you have already added an EC2 security group to your default cache security group.

The managing security groups documentation has detailed steps for Authorizing Network Access to an Amazon EC2 Security Group via the AWS console, API, or CLI. You will want to add the same EC2 security group that the instance running your application uses.

From the AWS Console:

  1. Launch the AWS Management Console.

    a. Go to the AWS Management Console web page.

    b. Select ElastiCache from the drop-down list under the Sign in to the AWS Console button, and then click the Sign in to the AWS Console button.

  2. Select Cache Security Groups from the navigation list on the left side of the console window.

  3. In the Cache Security Groups list, select the check box next to the cache security group that you want to grant access to.

  4. At the bottom of the window, in the EC2 Security Group Name list, select your Amazon EC2 security group.

  5. Click the Add button.

    Note: It takes approximately one minute for changes to access permissions to take effect.