NHibernate MemCached w/Protobuf-net.Enyim——它实际工作吗?
我使用以下程序集使用Protobuf net二进制序列化程序将NHibernate二级缓存与Enyim Memcached连接起来:NHibernate MemCached w/Protobuf-net.Enyim——它实际工作吗?,nhibernate,memcached,protobuf-net,nhibernate-caches,enyim.caching,Nhibernate,Memcached,Protobuf Net,Nhibernate Caches,Enyim.caching,我使用以下程序集使用Protobuf net二进制序列化程序将NHibernate二级缓存与Enyim Memcached连接起来: 亚硝酸铵 NHibernate.Caches.EnyimMemcached 恩伊姆 protobuf网 protobuf-net.Enyim 最近我注意到,尽管将protobuf net与EnyIMEMECached连接起来,但我可能没有实际使用该序列化程序,因为我的所有实体都只标记了[Serializable],而[DataContract]或[ProtoC
- 亚硝酸铵
- NHibernate.Caches.EnyimMemcached
- 恩伊姆
- protobuf网
- protobuf-net.Enyim
[Serializable]
,而[DataContract]
或[ProtoContract]
与属性对应的有序数据/ProtoMembers。在添加适当的属性(或使用protobuf net的RuntimeTypeModel.Default类手动注册属性)后,我可以在直接与memcache交互时让protobuf net与EnyImmeCache一起工作
但是,即使我在protobuf net上注册了我的类型,我也不认为任何来自NHibernate的缓存条目会被protobuf net序列化,因为NHibernate.Caches.enyimmemMacached将条目存储在DictionaryEntry
对象中的缓存中:
bool returnOk = client.Store(
StoreMode.Set, KeyAsString(key),
new DictionaryEntry(GetAlternateKeyHash(key), value),
TimeSpan.FromSeconds(expiry));
DictionaryEntry
没有[DataContract]
和[DataMember(Order=xx)]
属性。这让我想知道
我甚至可以正确地将protobuf网络序列化程序用于NHibernate二级缓存吗?既然没有人回答您的问题,我不妨在这里给出我的两个位。我不太了解Memcached作为二级缓存的情况,但是有一些强大的缓存解决方案,它们只需要很少的代码更改就可以开始用作二级缓存,序列化由缓存处理。你可以用