コード例 #1
0
        public ActionResult GetDifficulty()
        {
            bool exists;

            if (_cache.TryGetValue(_ip, out exists))
            {
                var strIPTimeout = "{ \"error\" : \"too much requests from your IP, put sleep 1 sec between requests\" }";
                return(Content(strIPTimeout, "application/json"));;
            }
            string str = string.Empty;

            try
            {
                str = mainCoins.GetRawQuery("getdifficulty");
            }
            catch
            {
                str = "{ \"error\" : \"data error\" }";
            }
            _cache.Set(_ip, true, _memoryCacheEntryOptions);
            return(Content(str, "application/json"));;
        }