Skip to content

Some questions about the behavior of AddInternal function #390

Closed

Description

@xingwen1987

As I understand it, if user add a cache to the CacheManager, the CacheManager should add cache item to each handle.

But the current implementation only add cache item into the last registered handle. [code here]

Here is a scenario, ServiceA is a cache write service, which registers a RuntimeCacheHandle and multiple RedisCacheHandle (Redis1 ~ Redis5) to write, and ServiceB is a cache read service, which registers a RuntimeCacheHandle and one RedisCacheHandle (Redis1).

if ServiceA use AddOrUpdate method to add a cache item, according to the current code logic, this cache item only write to Redis5, When ServiceB wants to get the cache item written by ServiceA from Redis1, this cache not exist because ServiceA not add this cache into Redis1.

I want to understand the intention of this design, looking forward to your reply.

Activity

  1. xingwen1987 commented on Sep 22, 2025

    @xingwen1987
    Author

    The current quick solution is to call GetCacheItem function immediately after ServiceA AddOrUpdate, so that all cache items will be written to all handles, but this writing method will cause great ambiguity.

    I guess if the purpose is to control. can we set a direction for each Handle, ReadWrite, WriteOnly, and ReadOnly?

    • When adding, filter out the ReadWrite and WriteOnly handles and add them one by one.
    • When reading, filter out the ReadWrite and ReadOnly handles and read them one by one.

    Will this help improve the robustness of the component?

  2. locked and limited conversation to collaborators on Sep 29, 2025
  3. converted this issue into a discussion #391 on Sep 29, 2025
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions