RoboZhando/Redis/Serialize/RedisConvert.cs
/// <summary>
/// Writes the object to the redis database
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="name"></param>
/// <param name="obj"></param>
/// <param name="TTL"></param>
/// <returns></returns>
Writes the object to the redis database
Writes the object to the redis database
[System.Obsolete("Not used anymore", true)]
        public async Task WriteAsync(Namespace name, object obj, TimeSpan? TTL = null, bool useTransaction = true)
        {
            if (useTransaction)
                Transaction = Client.CreateTransaction();
            Type type = obj.GetType();
            var serializer = GetSerializerForType(type, options: type.GetCustomAttribute<RedisOptionAttribute>());
            Debug.Assert(serializer != null);
            await serializer.WriteAsync(this, type, obj, name, TTL);
            if (useTransaction)
            {
                await Transaction.ExecuteAsync();
                Transaction = null;
            }
        }
[ System . Obsolete ( " " , true ) ] public async Task WriteAsync ( Namespace name , object obj , TimeSpan ? TTL = null , bool useTransaction = true ) { if ( useTransaction ) Transaction = Client . CreateTransaction ( ) ; Type type = obj . GetType ( ) ; var serializer = GetSerializerForType ( type , options : type . GetCustomAttribute < RedisOptionAttribute > ( ) ) ; Debug . Assert ( serializer != null ) ; await serializer . WriteAsync ( this , type , obj , name , TTL ) ; if ( useTransaction ) { await Transaction . ExecuteAsync ( ) ; Transaction = null ; } }
Writes the object to the redis database
Writes the object to the redis database
//Set the connection to a new transaction //Prepare the type //Serialzie the content //Execute the transaction and clear it
None
name
Namespace
None
obj
object
None
TTL
TimeSpan?
None
useTransaction
bool
typeparam
None