Skip to content

Conversation

@stebet
Copy link
Contributor

@stebet stebet commented May 25, 2025

Added a NATS Backplane

I added a new project which uses NATS as a backplane for cache events. It's relatively straightforward

Reduced allocations for backplane messages

I also noticed some easy improvements that could be made to drastically reduce allocations for Backplane message, so I did a few things.

  • BackplaneMessage is now a readonly struct instead of a class which means it can be allocated on the stack
  • BackplaneMessage now has a TryParse static method which tries to deserialize a ReadOnlySpan<byte> into a BackplaneMessage and now provides an instance method WriteTo which serializes the BackplaneMessage to an IBufferWriter<byte> with no allocations.

Made Backplane Tests easily extensible

I made the L1BackplaneTests and the L1L2BackplaneTests abstract classes which can easily be inherited and implement methods to provide the IFusionCacheBackplane and the IDistributedCache so tests for new backplane and Distributed Caches can easily be implemented.

This could be further improved by making these test classes perhaps take the Backplane and Distributed cache as parameters for parameterized tests. I might look at doing it like that to make it even easier.

Reducing allocations for backplane messages
Make Backplane Tests easily extensible
@jodydonetti jodydonetti self-assigned this May 26, 2025
@jodydonetti
Copy link
Collaborator

Hi @stebet , that is awesome, thanks!

I'll take a look at the changes in details in the nex few days, will ping back here.

@jodydonetti jodydonetti added the enhancement New feature or request label Jun 4, 2025
@jodydonetti jodydonetti added this to the v2.4.0 milestone Jun 4, 2025
@jodydonetti jodydonetti modified the milestones: v2.4.0, v2.5.0 Aug 16, 2025
@jodydonetti
Copy link
Collaborator

jodydonetti commented Oct 18, 2025

Hi @stebet , sorry for the delay, even though part of the blame for it is on your country... such an incredible place to visit 🙂

Anyway I've been finally able to resolve the conflict (by updating the SLN file to the new SLNX formt) and updated the branch.

I also added a couple of // TODO comments about a couple of things I quickly spotted: I still have to take a look at the rest, but it's a start.

Thanks!

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants