コード例 #1
0
        public object Any(TwitterTweets request)
        {
            var cacheKey = "cache:Tweet:" + request.ScreenName + ":tweets"
                           + (request.Take.HasValue ? ":take:" + request.Take : "")
                           + (!request.SinceId.IsNullOrEmpty() ? ":sinceid:" + request.SinceId : "")
                           + (!request.MaxId.IsNullOrEmpty() ? ":maxid:" + request.MaxId : "");

            //This caches and returns the most optimal result the browser can handle, e.g.
            //If the browser requests json and accepts deflate - it returns a deflated json payload from cache
            return(base.RequestContext.ToOptimizedResultUsingCache(Cache, cacheKey, () =>
                                                                   new TwitterTweetsResponse {
                Results = AuthTwitterGateway.GetTweets(
                    request.ScreenName, request.SinceId, request.MaxId, request.Take)
            }));
        }
コード例 #2
0
        public object Any(TwitterTweets request)
        {
            var cacheKey = "cache:Tweet:" + request.ScreenName + ":tweets"
                + (request.Take.HasValue ? ":take:" + request.Take : "")
                + (!request.SinceId.IsNullOrEmpty() ? ":sinceid:" + request.SinceId : "")
                + (!request.MaxId.IsNullOrEmpty() ? ":maxid:" + request.MaxId : "");

            //This caches and returns the most optimal result the browser can handle, e.g.
            //If the browser requests json and accepts deflate - it returns a deflated json payload from cache
            return base.RequestContext.ToOptimizedResultUsingCache(Cache, cacheKey, () =>
                new TwitterTweetsResponse {
                    Results = AuthTwitterGateway.GetTweets(
                        request.ScreenName, request.SinceId, request.MaxId, request.Take)
                });
        }