ZiggyCreatures / FusionCache

FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features.
MIT License
1.57k stars 84 forks source link

Possibility of creation of a count variable in distributed cache #208

Closed viniciusvarzea closed 4 months ago

viniciusvarzea commented 4 months ago

Describe the bug

This is not a BUG, this is a question.

I wondering if is there a way to create a count variable in distributed cache only.

We have a system that counts the failed loggin attempts, this system today is only a memoryCache with some lock features. We started to use fusionCache as our default cache. Is there any way to store count variables in the distributed cache of FusionCache without the risk of losing some increments, since we have some nodes incrementing this count?

jodydonetti commented 4 months ago

Hi @viniciusvarzea , no there's not.

I would suggest using directly the IConnectionMultiplexer from StackExchange.Redis, which directly exposes Redis primivites, including the ability to do counters.

ps: if you'll go down this path, you may istantiate the IConnectionMultiplexer once, and use the same instance directly (counter), for the distributed cache (RedisCache) and for the backplane (RedisBackplane) to save some resource and have better performance.

Hope this helps.

viniciusvarzea commented 3 months ago

Thank you @jodydonetti