3

How do I configure Azure Cache in web roles to use my custom IDataCacheObjectSerializer class? In case you are wondering why I want to use a custom serializer: I want to use the compact text based style JSON(.net) serialization combined with compression. In my .config files I can enable compression:

<dataCacheClient name="default" isCompressionEnabled="true"/>

But how / where do I tell Azure Cache (preview) to use my custom IDataCacheObjectSerializer class that uses JSON serialization?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • Check if this thread helps: http://stackoverflow.com/questions/3756480/appfabric-caching-can-i-specify-serialization-style-used-for-all-objects. – Ming Xu - MSFT Jul 20 '12 at 10:04

1 Answers1

3

Jagan Peri has a relevant blog post.

From the 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>
Allen Rice
  • 19,068
  • 14
  • 83
  • 115
Anton
  • 4,554
  • 2
  • 37
  • 60
  • wow great read, thats exactly what I was looking for. I added the config stuff since that should answer the question completely – Allen Rice Sep 11 '12 at 21:33