CacheManager icon indicating copy to clipboard operation
CacheManager copied to clipboard

Does CacheManager.Serialization.Json.GzJsonCacheSerializer support string values?

Open andreymir opened this issue 8 years ago • 3 comments

Here is my cache configuration

						cacheConfigBuilder
							.WithRedisConfiguration("redis", redisConnection.Value)
							.WithUpdateMode(CacheUpdateMode.Up)
							.WithSerializer(typeof(CacheManager.Serialization.Json.GzJsonCacheSerializer))
							.WithMaxRetries(1)
							.WithRetryTimeout(2)
							.WithRedisBackplane("redis", channelName: $"{environment.EnvironmentName}-backplane")
							.WithRedisCacheHandle("redis", isBackplaneSource: true);

When I put string into the cache it seems it is not compressed.

andreymir avatar Dec 08 '17 13:12 andreymir

Yeah, primitives do not have to be serialized, that's why a string doesn't go through the serializer/gz compression. You could easily do that yourself though and just cache the compressed byte array?

MichaCo avatar Dec 08 '17 14:12 MichaCo

I just wrapped a sting into a custom object. Maybe this could be mentioned in the documentation http://cachemanager.michaco.net/documentation/CacheManagerSerialization?

andreymir avatar Dec 08 '17 15:12 andreymir

Yup, documentation should probably have a statement about that

MichaCo avatar Dec 08 '17 15:12 MichaCo