XmlDocument is not serializable, so actually nothing is set in the
cache. I guess i should throw an exception when this happens.
You have 2 options:
1) This is the easier one, store the original xml. Either keep a
reference to the string or use _xml.InnerXml to recreate it.
2) Create a custom transcoder by implementing the ITranscoder
interface or deriving from the default trancoder )not sure if it has
been unsealed in the latest commit though), and serialize the xml
document any way you see fit to your needs
a.
On Mar 13, 2009, at 10:09 PM, Dustin wrote:
The object has to be serialized in some way to be stored. Is there
a reason you don't want to serialize it in an XML form?
On Mar 13, 1:35 pm, MLL <[email protected]> wrote:
hello,
I'm trying to cache an XML object:
Enyim.Caching.MemcachedClient client = new
Enyim.Caching.MemcachedClient();
XmlDocument _xml = new XmlDocument();
_xml.LoadXml(_dt.Rows[0]["DataXML"].ToString());
client.Store(StoreMode.Set, "XML_KEY", _xml, DateTime.Now.AddMinutes
(20));
but when I restore the object from the cache, I get null.
XmlDocument _xml = client.Get<XmlElement>("XML_KEY");
I try also:
XmlDocument _xml = (XmlDocument )(client.Get<object>("XML_KEY"));
I did test with strings and datatable and the Memcached process works
fine. Just with XML object I am not able to get the key.
Please, if you have any suggestion, I will be apreciate. I don't have
any idea, what to do.
Thanks very much
MLL