-
Notifications
You must be signed in to change notification settings - Fork 131
How to Get a HashSet from Redis Cache? #427
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
Comments
Hi @gmij you mean that App A is writing to Redis without going through FusionCache? Long story short: if you want to read from FusionCache, you need to write from FusionCache (so the data is saved in the correct format). Hope this helps. |
ok,,,,,i know. but....is a bad msg..... |
Can you explain more what you mean? |
What we hope to do is exactly what you understand. |
Got it. I may have something in mind... give some time to bake the idea... |
Hi @gmij , I have an update: I'm playing with the idea of implementing something called "distributed cache raw mode", where the idea is that, if you enable it (default is This though will also disable a whole set of FusionCache features (but not all), so it must be used with great care. Mind you, it's not yet 100% confirmed, and the design it's not set in stone, and I have a lot of cases to check, and etc... but I'm thinking about it. Would this be interesting for your use case? Now, more importantly, a couple of questions about your scenario:
Just to understand: you cannot or you don't want? And why? I'm trying to understand the use case better, thanks.
This looks more like using Redis as the database instead of as a distributed cache. For example, what happens if App B (only responsible for reading from Redis) does not see anything there? Does it have a factory that can grab the real data? If Redis contains the real data, like a database normally does, can this be a case where you can use FusionCache with only L1 (memory cache) and where Redis is used inside the factory as what is normally the database? What I mean is that the fact that it's Redis does not necessarily mean that it must be used as L2 (distributed cache). I hope I've been able to explain myself. Please let me know, thanks. |
hi... @jodydonetti I'm glad to see new progress on this matter. Regarding the several scenarios you mentioned, here's what I think.
These two applications are maintained by two distinct teams, with one of them believing that direct utilization of Redis suffices, as introducing hybrid caching would unnecessarily elevate complexity. Their application business logic is more intricate, yet their requirements for real-time performance are relatively lower.
The current scenario involves App B exposing a web API for App A to utilize. They load the required data from the database based on business needs and return it to us, with each access taking approximately one second. After discussing with them, they implemented a caching mechanism where the web API optimizes and returns data from the cache. Whenever the data changes, they update the cache to ensure we have access to the latest information. However, they directly manipulate Redis using the HashSet data structure, which hinders our ability to leverage a hybrid cache for loading. Initially, we hoped that the hybrid cache could accommodate HashSet data structures. Yet, from our previous discussions, we understood that there is additional metadata involved, making it challenging to manage. My suggestion is to separate metadata storage and data storage by placing them in different paths, such as using "v2:data:key" for data and "v2:metadata:key" for metadata. While this approach may increase maintenance costs across different paths, it could provide a clearer distinction and easier management. |
App A: use Redis, set to Redis with HashSet, key match FusionCache Role. v2:xxx:yyy
App B: use FusionCache to Load v2:xxx:yyy, the Data is null.
use Redis-Insight to Find data. the key has Data.
The text was updated successfully, but these errors were encountered: