Caching strategy when using API's that have a limit on number of calls allowed?

I am making an app using twitter API that needs to use the twitter REST API to find the followers of a user frequently . But twitter has a restriction of 350 API requests in an hour . My App in its current state is sure to exceed that. Please tell me what kind of caching strategy should I employ to reduce the number of API calls I make and thereby improve speed of my app and the follow twitter policies without any problem.

-------------Problems Reply------------

Abstract your access to Twitter API and do something along these lines.

If last call to Twitter at least 12 seconds ago
Make new call to Twitter and store returned info
Set Timestamp
else
Return last stored data
endif

This means that only one part of your program needs to know about the restriction and all other parts can treat the data as having come fresh from Twitter.

In the light of your comment, the above pseudo-code becomes

If last call to Twitter at least 12 seconds ago
Make new call to Twitter and save follower list in DB
Set Timestamp
endif

Return follower list from DB

I would be inclined to have this sort of structure in one table, at least at first.

twitter_id
.
.
whatever else you want to store about the person
.
.
followers VARCHAR space-separated list of follower IDs

Obviously, this would be a simplistic approach, but on the basis of 'the simplest thing that works' it would be fine.

Category:caching Views:0 Time:2011-09-05

Related post

  • What caching strategy/technology should I use for this php/mysql xml generating api 2012-11-15

    I am developing a php/mysql based api that returns generated xml from executing multiple sql queries and then assembling the result sets into a single xml string/document. I will have multiple clients requesting various flavours of this api for examp

  • What caching strategy would best suit this problem? 2008-11-18

    First of all, let me say I am very new to rails, have been working with it for only a couple of days. My first application is a little different from traditional: on one of my model classes I have parts of data that is pulled from a database and othe

  • Caching strategy, Output Cache vs Data Cache or both? 2009-02-17

    I'm working on an ASP.NET MVC project and I've come to the point where I want to start considering my caching strategy. I've tried to leave my framework as open as possible for the use in caching. From what I heard during Scott Hanselman's podcast St

  • hibernate cache strategy 2009-12-03

    how to decide whitch CacheConcurrencyStrategy to use? NonstrictReadWriteCache, ReadOnlyCache, ReadWriteCache, TransactionalCache . I read https://www.hibernate.org/hib%5Fdocs/v3/api/org/hibernate/cache/CacheConcurrencyStrategy.html but doesn't explai

  • Caching Strategy for queried data 2009-06-03

    I'm currently in the process of building a repository for a project that will be DB intensive (Performance tests have been carried out and caching is needed hence why I'm asking ) The way I've got it set up now is that each object is individually cac

  • What caching strategy do you use for a Database dependant ASP.NET App? 2009-08-17

    I'm looking for a good caching strategy for an CRM App written in ASP.NET. Almost all sites depend heavily on the database, which means caching parts/the whole page for some time does not work in my situation. Is there any other way you use caching i

  • What is DLR three-level caching strategy 2010-11-11

    I just heard that DLR has a three level caching strategy.. But what it is .. A simple explanation with simple example will be very helpful. Thanks --------------Solutions------------- This is how I understand it, the idea of the caching is to reuse e

  • EhCache, JPA 2.0 L2 cache, Caching strategy 2011-01-17

    HI all, I'm new to the world of L2 Caching so please go easy on me :). I have a few questions: 1) What would be the difference between EhCache vs JPA 2.0 L2 Cache? To my understanding, EhCache is distributed (can also be stand-alone), while JPA 2.0 L

  • Caching strategy for heavily used web-site 2011-02-10

    We’re in process of designing caching strategy for a heavily used web-site. The site consists of a mix of dynamic and static content. The front-end is PHP, middle tier is Tomcat and mysql on the back. Only user login screen is done over HTTPS to secu

  • When developing an application is it standard to architect the caching strategy concurrently or after the app is built? 2011-03-10

    Caching a complex application can get hairy very quickly. My question is do developers generally build their caching strategy in WHILE developing the application or is it easier to build the application and then go back and layer a caching strategy o

  • Caching strategy for small immutable objects in Java? 2011-04-25

    I am developing an app that creates a large number of small, immutable Java objects. An example might be: public class Point { final int x; final int y; final int z; ..... } Where it is likely that many instances of Point will need to refer to the sa

  • How to send "Cache-Control: no-cache" header in Piwik API responses 2011-08-14

    I have a Piwik install sitting behind a varnish-caching server. My problem is varnish is by default caching responses to my API calls. Unfortunately, I don't have direct access to the varnish server, so I need to send the "Cache-Control: no-cache" he

  • ASP.NET caching strategy 2011-09-07

    I'm working on implementing data caching for commonly used database objects and I'm having some difficulty deciding the best strategy for caching the following scenario: I have an table called Campaigns with 1423 records. A Campaign contains all the

  • REST: What is a good Hypermedia and Resource Caching Strategy? 2011-12-16

    If I have a RESTful service that has discoverable resources via an endpoint such as: Request: GET http://acme.org/someInfo Response: HTTP/1.1 200 OK Content-Length: ... Content-Type: application/vnd.acme+xml Date: Fri, 16 Dec 2012 12:40:00 GMT Last-M

  • Creating a backing store and cache strategy using MonoTouch 2012-01-30

    While I have seen an example of using CoreData to perform this (and the subsequent mess that it leaves in your code), I would prefer to create a simple backing store to sqllite. Are there any simple examples or decent cache strategy mechanisms that a

  • Best Offline Caching Strategy for handling enormous Database 2014-09-01

    I am working on web application which has enormous Database and part of that will display data in tree structure(Expandable) and Tree will consist of various categories and subcategories. Handling this much of data will be mess and performance will b

  • How many DB reads can we cache in Asp.net application? is there any limit 2010-06-30

    How many DB results can we cache in Asp.net application? is there any limit e.g if we cahce DataSet with 1000 rows data and we cache it through sqlCacheDependency. --------------Solutions------------- You dont cache "DB reads", you cache the result r

  • Is there a limit on number of placemarks returned by Google Maps Geocoding API v2? 2011-03-25

    So, the question is: is there a limit on number of placemarks returned by Google Maps Geocoding API v2? I searched through the web but this limit (if it exists) is nowhere explicitly stated. However I've never seen Geocoding API return more than 10 p

  • Is it possible to limit the number of $_GET parameters to a Zend Framework application using Zend_Cache_Backend_Static to cache static pages as HTML 2012-02-17

    I've just set up static page caching using Zend_Cache_Backend_Static to serve cached html files in my application, which is working great. The only concern I have is down to the way it caches files with $_GET parameters. Because it automatically crea

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.165 (s). 11 q(s)