0

I have a requirement where I need to implement memcached (Amazon.ElasticCache and Enyim Cache) with my existing .NET project. There are lot of existing complex objects in the project which i need to store in the cache. what I realzied is that, i need to implement ISerializable and decorate class with [Serializable] attribute. There are lot of Classes in my project which gonna be a tedious task for me implement ISerializable.

I tired just with [Serializable] attribute but it's not adding to cache.

Any suggestions?

nimi
  • 5,359
  • 16
  • 58
  • 90
  • 1
    *Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).* – jww Feb 16 '18 at 01:42
  • Do you have an [mcve]? – ProgrammingLlama Feb 16 '18 at 01:58

1 Answers1

0

I faced similar issue while trying to connect with Memcached. You need to make sure all your objects are serializable by using the attribute [Serializable].

Also make sure, it is working with a unit test. More details about testing serialization can be found here - How to unit test if my object is really serializable? .

Then set up a local memcached server and make sure the connection and data transfer is working. You can mock Amazon Elastic Cache by using this library - https://github.com/hybridtechie/fake-elasticache-.NET-version

Hope this helps

hybrid
  • 1,255
  • 2
  • 17
  • 42