Serialization for memcached
Posted
by Ram
on Stack Overflow
See other posts from Stack Overflow
or by Ram
Published on 2010-04-01T17:57:41Z
Indexed on
2010/04/01
18:13 UTC
Read the original article
Hit count: 179
I have this huge domain object(say parent) which contains other domain objects. It takes a lot of time to "create" this parent object by querying a DB (OK we are optimizing the DB). So we decided to cache it using memcached (with northscale to be specific)
So I have gone through my code and marked all the classes (I think) as [Serializable]
, but when I add it to the cache, I see a Serialization Exception getting thrown in my VS.net output window.
var cache = new NorthScaleClient("MyBucket");
cache.Store(StoreMode.Set, key, value);
This is the exception:
A first chance exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
SO my guess is, I have not marked all classes as [Serializable]
. I am not using any third party libraries and can mark any class as [Serializable]
, but how do I find out which class is failing when the cache is trying to serialize the object ?
Edit1: casperOne comments make me think. I was able to cache these domain object with Microsoft Cache Application Block without marking them [Serializable]
, but not with NorthScale memcached. It makes me think that there might be something to do with their implementation, but just out of curiosity, am still interested in finding where it fails when trying to add the object to memcached
© Stack Overflow or respective owner