-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Add MemoryPack support #89
Comments
thanks for adding it.
Due to the .NET runtime compatibility issue, libraries supporting MemoryPack must be
You can use
I don't think it's a bad idea, I think it's a legitimate measure. |
Thanks to you for creating it!
Yeah it's not a beauty to look at 😅 My thoughts were that, for example, by calling it just "MessagePack" that may have been seen as the MessagePack package, and not a MessagePack package. The thing becomes more obvious for Json, where we have 2 main packages, and also for Protobuf (the one from Marc Gravell and the one from Google). In this specific case it may make more sense, since the protocol itself comes from that very package. I'll think about it!
Ok so I have to add 2 tfm, got it! While we are at it: do I also have to let the generator generate the code and grab the code twice?
I missed that, will update it soon.
Ok, good to know. Overall thanks again, your help is very welcome 🙏 |
protobuf-net is Marc's, Google.Protobuf is Google's.
Yes! |
Yes, that is something I considered, but in the end I thought it would've been too nuanced for the general public to get right, and preferred being explicit in the name to avoid confusion.
Let's hope! I guess we'll find out with the community response. Also, since I list all the available packages both in the main README and in the cache levels page I hope that may help, too.
Ok got it, I'll keep track of that and may eventually release a new version in case support in .NET will catch up. Thanks! |
Branch updated, now the code feels way more clear! |
I've update the document, make wrapper type is easy to create external type formatter. |
Woah, thanks @neuecc ! I was thinking about creating an issue to ask for such a feature, but you beat me to it 😬 FYI, just as a thought excercise and a little brainstorming, I thought about the same approach but was worried about the need for extra allocations. public class Foo
{
public int Prop1 { get; set; }
public string Prop2 { get; set; }
public float PropToBeIgnored { get; set; }
}
// IN ANOTHER ASSEMBLY
[MemoryPackableFor(typeof(Foo))]
public partial class FooSurrogate
{
[MemoryPackInclude]
public int Prop1 { get; set; }
[MemoryPackInclude]
public string Prop2 { get; set; }
[MemoryPackIgnore]
public float PropToBeIgnored { get; set; }
} My idea was based on trying to let you change as little as possible in the generator code, with something potentially simple in the first few lines just to change the target type of the generator from the one where the Basically the logic would have been something like:
I don't know if this approach would have some downsides though, but I wanted to share my idea with you, maybe you can find something interesting. Anyway I will update the code asap. Thanks! |
Hi, in the end the code was already working well, and the idea of not having to allocate an extra class per each (de)serialization call is nice. I cleaned up a couple of small things, but apart from that everything remained the same. I'm almost ready to release it, fingers crossed 🤞 |
The just released v0.17.0 includes the MemoryPack support 🎉 |
Is your feature request related to a problem? Please describe.
FusionCache provides a way to add custom serialization format support, by implementing the
IFusionCacheSerializer
interface.It already provides 4 implementations:
It would be great to add support for the new super optimized binary format by @neuecc , MemoryPack !
Describe the solution you'd like
A new package that add supports for the MemoryPack format, based on MemoryPack.
Describe alternatives you've considered
Everyone that needs it should otherwise implement their own, which is meh 😐
The text was updated successfully, but these errors were encountered: