Exemple #1
0
        public async Task <bool> PutStringAsync(string i_Key, string i_Value, TimeSpan i_TTL)
        {
            bool putActionResult;

            try
            {
                m_Logger.LogInformation(string.Format(FUNCTION_CONTEXT_FORMAT, "PutStringAsync", i_Key));
                int ttlInSeconds = Convert.ToInt32(i_TTL.TotalSeconds);
                await m_Client.AddAsync(i_Key, i_Value, ttlInSeconds);

                var cacheResult = await m_Client.GetAsync <string>(i_Key);

                putActionResult = cacheResult.Success;
            }
            catch (Exception ex)
            {
                m_Logger.LogInformation(string.Format(EXCEPTION_MESSAGE, EngineType, "PutStringAsync", LogUtils.GetExceptionDetails(ex)));
                putActionResult = false;
            }

            return(putActionResult);
        }