如何在Web角色中配置Azure Cache以使用我的自定义IDataCacheObjectSerializer类?如果您想知道我为什么要使用自定义序列化器:我想使用基于压缩文本的样式JSON(.net)序列化与压缩相结合。在我的.config文件中,我可以启用压缩:
<dataCacheClient name="default" isCompressionEnabled="true"/>
但是我如何/在哪里告诉Azure Cache(预览)使用我使用JSON序列化的自定义IDataCacheObjectSerializer类?
答案 0 :(得分:3)
Jagan Peri有relevant blog post。
来自帖子:
<dataCacheClients>
<tracing sinkType="DiagnosticSink" traceLevel="Verbose" />
<!-- This is the default config which is used for all Named Caches
This can be overriden by specifying other dataCacheClient sections with name being the NamedCache name -->
<dataCacheClient name="default" useLegacyProtocol="false">
<autoDiscover isEnabled="true" identifier="WorkerRole1" />
<!--<localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" />-->
<serializationProperties serializer="CustomSerializer" customSerializerType="Your.Fully.Qualified.Path.To.IDataCacheObjectSerializer,WorkerRole1" />
</dataCacheClient>
</dataCacheClients>