コード例 #1
0
        public override void Store(string objectName, object instance)
        {
            string key          = CreateKey(objectName);
            string value        = JsonSerialization.SerializeJson(instance);
            string cacheKey     = GetCacheKey(key);
            var    keyValuePair = new KeyValuePair(key, value);

            DataStoreData.UpdateDataStoreItem(keyValuePair);

            Caching.CacheManager.Remove(cacheKey);
        }
コード例 #2
0
        private static T ObjectInstance <T>(string key)
        {
            string       value         = null;
            KeyValuePair dataStoreItem = DataStoreData.GetDataStoreItem(key);

            if (dataStoreItem != null)
            {
                value = dataStoreItem.Value;
            }

            T objectInstance = JsonSerialization.DeserializeJson <T>(value);

            return(objectInstance);
        }