Skip to content

HybridCache serialization issues when in-memory #6063

Description

@BrianVallelunga

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions