HybridCache serialization issues when in-memory
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 894
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 23
Description
### Description
I'm not sure if this is a bug or a misunderstanding, but when storing only locally, why is the data being serialized? I'd assume I could store any sort of object (interfaces, classes, etc) in a local, memory cache.
### Reproduction Steps
My factory function returns a Task of an interface (IBloomFilter in this case). I'm passing the `HybridCacheEntryFlags.DisableDistributedCache` flag into the cache method as follows:
return `hybridCache.GetOrCreate("BloomFilter", factory, HybridCacheEntryFlags.DisableDistributedCache)`
### Expected behavior
The object wouldn't go through serialization when caching locally in memory.
### Actual behavior
An exception is thrown: `System.NotSupportedException: Deserialization of interface or abstract types is not supported. Type 'BloomFilter.IBloomFilter'`
### Regression?
_No response_
### Known Workarounds
_No response_
### Configuration
.NET 9, HybridCache 9.2.0-preview1.25105.6
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.