I tried like following
var Settings = new RedisSettings("localhost");
public async void SetData< T >(IEnumerable< T > collection, string Key)
{
RedisDictionary< object, T > mydictionary = new RedisDictionary< object, T >(Settings, typeof(T).Name);
//how to add collection data into dictionary
// i tried like following but failed
await mydictionary.Set(new[] { new KeyValuePair< object, IEnumerable< T > >(Key, collection) });
but it is not able to insert value into redis dictionary :( I have used
Your code does not seems to be related to StackExchange.Redis
. It's probably related to ServiceStack.Redis
.
Anyway if you're looking for handling Redis Hashes as .NET dictionaries with a non-commercial client, like StackExchange.Redis
, I recommend you to use the CachingFramework.Redis library that relies on StackExchange.Redis.
Here is the code for the RedisDictionary
implementation. (see the documentation )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.