I am wanting to compress results from QUERYS of the database before adding them to the cache.
I want to be able to compress any reference type.
I have a working version of this for compressing strings.. the idea based on scott hanselman ‘s blog post http://shrinkster.com/173t
any ideas for compressing a .net object?
I know that it will be a read only cache since the objects in the cache will just be byte arrays..
This won’t work for any reference type. This will work for Serializable types. Hook up a
BinaryFormatterto a compression stream which is piped to a file:You could use a
MemoryStreamto hold the contents in memory, rather than writing to a file. I doubt this is really an effective solution for a cache, however.