Skip to content

ICacheManager OnXyz event wires getting crossed #310

Closed

Description

@erizzo

I have 2 ICacheManager instances, ICacheManager<Foo> and ICacheManager<Bar>. One is a typical in-memory handle+Redis handle+backplane setup, the other is in-memory handle only with Redis backplane.
For the <Foo> cache manager only, I register with the OnXyz events (OnAdd, OnPut, OnRemove, etc) to just write some log messages when those events happen, including the eventArgs.key.

What's strange is that I'm getting events for both cache manager instances, both <Foo> and <Bar>. In the debugger, I see an event with the Bar keys and the sender arg is actually the ICacheManager<Foo> instance!

I've set a breakpoint at the point where I add my event listeners (fooCacheManager.OnAdd += ...) to confirm that it is only being called once, so I'm confused why my little monitor is getting all events for the other instance.

Activity

  1. erizzo commented on Apr 3, 2020

    @erizzo
    Author

    Also interesting (to me at least) is that the events always have an Origin of Remote even though my current testing only involves my single process connected to Redis running locally - all Puts, Adds, Updates, and Removes are running in a single process.

  2. MichaConrad commented on May 31, 2021

    @MichaConrad
    Collaborator

    Sorry for the late answer,

    Regarding why the second cache receives events, isn't that what you want if you use the backplane with in-memory cache?
    Even without an actual redis backend, the backplane will try to invalide things if possible.
    So, whenever the Foo instance changes something, the Bar instance will get notified via the backplane.

    If you don't want that, you can configure different backplane channel names.

  3. locked and limited conversation to collaborators on May 31, 2021
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