Server: Redis version of the operating environment, the production environment is full memory run.
Client NuGet Introduction: Servicestack.redis
Add the Cache code:
<summary>//Set///</summary>// <typeparam name= "T" > Type </typeparam >// <param name= "key" > Key </param>// <param name= "T" > Value </param>// < param name= "Timeout" > How many minutes after expiration </param>// <returns></returns> public static bool Set <T> (string key, T T, double minout = 60*3) { using (var redisclient = redismanager.getclient ()) {
key = "str_" + key; Return redisclient.set<t> (Key, T, Expiredatetime (minout)); } }
However, after a corresponding time, the cache is not invalidated. Made a variety of attempts .... At last:
Get all cache names
List<string> Getallkeys ();
Clear the point, or you can kill it all.
void Flushall (); T get<t> (string key); Idictionary<string, t> getall<t> (ienumerable<string> keys); Long Increment (string key, uint amount); BOOL Remove (string key); void RemoveAll (ienumerable<string> keys);
Hope to give some methods. Solving problems is not all about technology, but also the way.
Temporary workaround for Servicestack.redis cache expiration, not invalidated