Cache Server like Redis Vs Static variable
c#, caching, stackexchange.redis, static
Solution
If the data is truly static, then while yes you could store the data in redis, you would not usually go to redis every time - so it would probably end up having a local cache anyway (with redis as a second level cache). `static` can work fine for things like a read-only array, and this will be unbeatable in terms of performance. However, if you start mutating the contents of a `static` member: expect pain.
Problem
I wanna cache an array of object that is not more than 300 items, It's read only array. First I implemented it in Redis with StackExchange.Redis client, and then implement it by static variable. Static variable has e better performance and get less CPU usage instead of Redis, but I do not know that is it good way or not?