Can only store strings?
another silly question as I get my head around this - apologies.
Assuming the following against a working cache:
[CODE]MembaseClient client = new MembaseClient();
client.Store(StoreMode.Set, "Test1", new { Message = "Hello World" }); // no
client.Store(StoreMode.Set, "Test2", "Hello world"); // yes
client.Store(StoreMode.Set, user.UserId.ToString(), user); // no
[/CODE]
only the second line works - I don't seem able to Store anything other than strings?
I've looked against the running membase console for that bucket, and it appears that there is no activity against line 1, line 2 generates activity (and adds it to the cache), line 3 does nothing.
I seem to remember reading something about text and binary mode, but can't find a setting for it anywhere.
Any help gratefully appreciated.
Kind Regards,
Terry
To store objects in the cache they must be serializable. (If you enable logging I think this will show up in the log as well.)
you have 3 options
1. add the [Serializable] attribute to your data classes
2. implement ISerializable
3. If none of the above are possible (for example 3rd party sealed classes, etc.), you can create a custom serializer, by implementing the ITranscoder interface (or just inherit from the DefaultTranscoder, which is a good starting point to check out how is that working.)