.Net Redis Cache with support for tagging
To allow detection of cache expiry, configure redis with
config set notify-keyspace-events Ex
##Features
- Simple key value caching
- Cache item expiry
- Store cache items with tags
- Retrieve cache items by tag
- Remove all items by tag
- Multiple Serialization options
- Basic logging interface
PM> Install-Package TagCache.Redis
Any unset properties will use default values
varconfig=newCacheConfiguration(){RootNameSpace="_RedisCache",Serializer=newBinarySerializationProvider(),RedisClientConfiguration=newRedisClientConfiguration(){Host="localhost",DbNo=0,TimeoutMilliseconds=500}};varcache=newRedisCacheProvider(config);varcache=newRedisCacheProvider();// will default to localhoststringkey="TagCacheTests:Add";Stringvalue="Hello World!";DateTimeexpires=newDateTime(2099,12,11);cache.Set(key,value,expires);stringkey="TagCacheTests:Add";Stringvalue="Hello World!";DateTimeexpires=newDateTime(2099,12,11);vartags=newList<string>{"tag1","tag2","tag3"};cache.Set(key,value,expires,tags);vartest=cache.Get<String>("mykey");varresults=cache.GetByTag<String>("tag2");cache.Remove("key1");cache.Remove(newstring[]{"key2","key3"});cache.RemoveByTag("tag1");varcache=newRedisCacheProvider();cache.Logger=newMyLogger();// MyLogger : IRedisCacheLogger