Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6567217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:18:37+00:00 2026-05-25T14:18:37+00:00

I am developing an application that presents a company’s twitter feed on a Facebook

  • 0

I am developing an application that presents a company’s twitter feed on a Facebook application. This is a large company with lots of traffic to the FB App so I need to cache the Twitter data I receive (from the twitter API) so that I can avoid their rate limits.

In my code, I use LinqToTwitter to call the API and then I construct a string of JSON with the results. That string is then fed to the user’s browser via AJAX.

The rate limit for Twitter API calls is 150 per hour, so I figure I will just place the string of JSON data I construct in a cache object and only refresh it once per minute leaving me well below the Twitter rate limit.

The problem is that I am fairly new to MVC for .NET and can’t seem to use System.Web.Caching like I could do in a webforms application.

In older webforms apps I simply did something like:

            private string KeyTwitterData;

            ...

            string data = null;
            if (Cache[KeyTwitterData] == null)
            {
                var url = LinqToTwitter.Request.Url;
                data = ServiceMethods.GetConversation(url);
                Cache.Insert(KeyTwitterData, data);
            }
            else
            {
                data = (string)Cache[KeyTwitterData];
            }

Can someone please tell me how to accomplish this in MVC3?

Thanks!

Matt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:18:38+00:00Added an answer on May 25, 2026 at 2:18 pm

    In ASP.NET MVC 3 if you want to cache the result of a controller action you could decorate it with the [OutputCache] attribute:

    [OutputCache(Duration = 3600, Location = OutputCacheLocation.Server, VaryByParam = "none")]
    public ActionResult Foo() 
    {
        var model = SomeExpensiveOperationToFetchData();
        return View(model);
    }
    

    If you don’t want to cache the entire output of a controller action you could use the MemoryCache class:

    var data = MemoryCache.Default[KeyTwitterData];
    if (data == null)
    {
        data = SomeExpensiveOperationToFetchData();
        MemoryCache.Default.Add(KeyTwitterData, data, DateTime.Now.AddMinutes(5));
    }
    
    // use the data variable here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I`m developing this application that need to read every key stroke while the application
I'm developing an iPhone app. I need to create a Quiz application that has
I'm developing an application that gets large images from an Internet server which is
I am developing a Java application using Google App Engine that depends on a
Our company is developing a new application, which has a somewhat large business data
When developing an application that sends out notification email messages, what are the best
I'm developing and application that runs as a Windows service. There are other components
I'm developing an application that manages network interfaces on behalf of the user and
I am developing an application that needs to use regini (because of legacy reasons)
I am actually developing and application that has around 15 modules, all of them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.