Apachai.Apachai.FetchStatistics C# (CSharp) Method

FetchStatistics() private method

private FetchStatistics ( IManosContext ctx, string id ) : void
ctx IManosContext
id string
return void
        public void FetchStatistics(IManosContext ctx, string id)
        {
            string json;

            if (store.TryGetCachedStats (out json)) {
                ctx.Response.HandleJson (json);
                return;
            }

            var dict = new Dictionary<object, object> ();

            int picCount, userCount;
            store.GetCountStats (out picCount, out userCount);

            dict["picNumber"] = picCount;
            dict["userNumber"] = userCount;
            dict["latestPics"] = store.GetLastPicturesIds ().Cast<object> ().ToList ();

            json = JSON.JsonEncode (dict);

            store.SetCachedStats (json);

            ctx.Response.HandleJson (json);
        }