Please note Terms and Conditions changed January 7th, 2013. To continue using your account without interruption, your organization must complete the steps outlined below:

Steps to update your AT&T API Access Subscription:

  1. Sign new Terms & Conditions.
  2. Provide a valid US credit card. For users outside the US, please contact support.
  3. Review and Submit.
X

Your session is about to expire in !



Stay Signed In Ignore
X

Sorry! Your session has expired.



HomeDeveloper Program
  • Advanced Search
Sign In | Not a member? Join Now >
Twitter Link Facebook Link
  • Home
  • APIs & Tools
    • APIs
    • SDKs & Tools
    • Case Studies
    • Tutorials
    • Sample Apps
    • Console
    • Docs
    • Free Trial Access
    • Pricing
  • Program Features
  • Devices
  • Community
    • Blog
    • Events
    • Forums
    • Hackathons
  • Build Your App:

  • Learn
    • Platforms & OSes
    • Network Technologies
    • Enterprise Reference Library
    • Enabling Technologies
  • Develop
    • Get AT&T ARO
    • Use AT&T ARO
    • Find SDKs and Tools
    • AT&T Foundry
    • AT&T Cloud Services
    • Resources and Alerts
  • Launch
    • Launch Through AT&T
    • Distribute Consumer Apps
    • Go To Market Excellence
    • Distribute Business Apps
  • Support
    • Bug Bounty
    • Forums
    • FAQs
    • Tech Tips
    • Live Chat
Member Sign In
Forgot your Username or Password?
Search for...
Keywords
Site Section
Home > Develop > Resources and Alerts > Suggested Best Practices > Build Efficient Apps > Handle Duplicate Content and Caching

You might also like...

Network Technologies

Find SDKs and Tools

  • App Privacy Guidelines
  • Build Efficient Apps
    • Understand Mobile Networks
    • Handle Multiple Simultaneous TCP Connections
    • Reduce Inefficient Connections with Periodic Transfers
    • Deal with Connection Opening Problems
    • Close Connections As Soon As Possible
    • Offload to Wi-Fi
    • Handle Duplicate Content and Caching
      • Deep Dive: Duplicate Content
      • Deep Dive: Cache Expiration
      • Deep Dive: Cache Control
    • Utilize Pre-fetching
    • Manage Peripherals
    • Upgrade from HTTP 1.0
    • Handle Screen Rotations
    • Comparing LTE and 3G Energy Consumption
    • Content Optimization for Mobile Devices
  • Building Scalable Cloud-Based Apps
  • UI Design Principles
  • Best Practice Deep Dive — HTTP 400 and 500 Error Codes
  • Best Practice Deep Dive — HTTP 300 Status Codes
  • Best Practice Deep Dive — Text File Compression
  • PrintPrint this for your reference
  • EmailEmail this to your friends

Handle Duplicate Content and Caching

Duplicate Content:

When we're testing apps, we often see ones that download duplicate HTTP objects. By "duplicate content" we mean:

  • Content that has no caching information in the headers (examples of caching information are "Max-Age" and "Expires" lines in the header).
  • Content that has valid caching information that is not expired (yet the files were downloaded anyway).
  • Content that has been cached, the caching information has expired, the file was unchanged on the server — but the file was still downloaded anyway. This is typically caused by the client, which does not perform cache validation by including "If-Modified-Since" or "If-None-Match" directive in an HTTP request header.
  • Content that has been cached, the caching information has expired, but the file was unchanged on the server, and the server generated a 304 response. In this case, since the file was not downloaded again, this is a desirable result.

Couple of ways to come at this one...

On the server:
  • Be sure to properly set the caching information. If your setting is too short, it may cause content that is still current to be reloaded multiple times.
  • If the object is not changed, use HTTP 304 instead of transferring the whole object.

On the client:

  • Use a cache. Simple, eh?
  • Make sure you're properly handling HTTP caching. If the object is cached and the caching information is not expired, there's no need to issue an HTTP request.
  • When a cache entry expires, the UE should perform cache validation by using an "If-Modified-Since" or "If-None-Match" directive in an HTTP request header. Otherwise the server won't be able to use HTTP 304.
Caching:

We've also found that many applications repeatedly download files and data, even when there are no changes to the files. Since many developers are using content that has been optimized for the mobile web, the content is already populated with the caching headers required. In this case, a local cache for the application must be invoked.

Caching is an important tool for the mobile developer.

  • Cached files are instantly available, with no download lag. That means your application feels faster to the user. Caching makes batteries last longer.
  • Every time your app needs to make a data connection, it drains the battery. Hog too much battery and users will dump your app.
  • Downloading files over and over increases data usage and cost users money. Guess what they think about apps that cost them extra money.
  • Wireless networks have limited capacity. If you clog the tubes with needless downloads, it slows everyone down.

Believe it or not, even a 4kb image can make a huge difference. Let's say your app has 5,000 users (congrats, by the way). If they have to download a single 4kb image twice each session, it means 19MB of needless data sent to your users. And that means using the radio power to drain more than a third of a Samsung Captivate™ battery.

To cache effectively, your content needs headers. This change has to be made at the server level. If you're ready to implement a caching regime, it's important to think about your content's lifespan.

For example...

  • Sports team logos — long shelf life
  • Blog post — a shelf life of just hours
  • News images — perhaps a day
  • News stories — changes several times an hour
  • Weather data — could easily change every 5-10 minutes

Once you determine the appropriate timings, you can add the right headers.

Want to learn more about managing Caching? Read our Best Practices document: Top Radio Resource Issues in Mobile Application Development and have some fun playing the game below:

What would happen if your user reacted the same way as an app that doesn't cache its data? As the forecast stays the same, he'll load up multiple shirts and get awfully warm on a sunny day.

Play Now!

Updated: 12-09-2011
Created: 10-06-2011
Footer
  • AT&T Terms of Use Privacy Policy Site Map Contact Us

© AT&T Intellectual Property. All rights reserved.

AT&T, the AT&T logo and all other AT&T marks contained herein are trademarks of AT&T Intellectual Property and/or AT&T affiliated companies. AT&T 36USC220506