Example #1
0
        /// <summary>
        ///     Stores the specified value associated to the identifier object.
        /// </summary>
        /// <param name = "data"></param>
        /// <param name = "key"></param>
        /// <param name = "value"></param>
        /// <param name = "expiry"></param>
        public static void Store(this IDataIdentify data, String key, Object value, DateTime expiry)
        {
            try
            {
                var translatedKey = data.TranslateKey(key);

                DefaultCache.Set(translatedKey, value, expiry);
            }
            catch (Exception e)
            {
                STrace.Exception(typeof(LogicCache).FullName, e);
            }
        }
Example #2
0
        /// <summary>
        ///     Determines if the givenn key is present in cache for the current object.
        /// </summary>
        /// <param name = "data"></param>
        /// <param name = "key"></param>
        /// <returns></returns>
        public static Boolean KeyExists(this IDataIdentify data, String key)
        {
            try
            {
                var translateKey = data.TranslateKey(key);

                return(DefaultCache.KeyExists(translateKey));
            }
            catch (Exception e)
            {
                STrace.Exception(typeof(LogicCache).FullName, e);

                return(false);
            }
        }
Example #3
0
        /// <summary>
        ///     Retrieves the value associated to the givenn key and identifier object.
        /// </summary>
        /// <typeparam name = "T"></typeparam>
        /// <param name = "data"></param>
        /// <param name = "key"></param>
        /// <returns></returns>
        public static T Retrieve <T>(this IDataIdentify data, String key) where T : class
        {
            try
            {
                var translateKey = data.TranslateKey(key);

                var value = DefaultCache.Get(translateKey);

                return(value as T);
            }
            catch (Exception e)
            {
                STrace.Exception(typeof(LogicCache).FullName, e);

                return(default(T));
            }
        }