SlideShare a Scribd company logo
Android HTTP Cache
                  (     )
                            2010-09-18




2010-10-03
Android HTTP
             •   java.net

                 •   Java

                 •          HTTP             HttpURLConnection

             •   org.apache.http

                 •   Apache HttpClient 4.0   Android

                 •   HTTP

             •   android.webkit

                 •   Android       Android UI     Web

                 •   HTTP                              Web




2010-10-03
(HTTP       )




             •   Android HTTP
                 (3G      300kbps 2000kbps)

             •                  →             →


             →




2010-10-03
(   )



             •
                 •
                 •               (           )

                 •
             •
             →HTTP/1.1 Caching




2010-10-03
HTTP/1.1 Caching




             •   RFC2616

             •         Web          Web

             •   HTTP/1.1 Caching   HTTP




2010-10-03
HTTP/1.1 Caching

             •                  HTTP

                 •   If-Modified-Since

                     •


                 •   If-None-Match

                     •




2010-10-03
HTTP/1.1 Caching

             •                   HTTP

                 •   Expires

                     •
                 •   Last-Modified

                     •                        If-Modified-Since

                 •   ETag

                     •                                           If-None-
                         Match




2010-10-03
HTTP/1.1 Caching


             •                         HTTP

                 •   Cache-Control

                     •
                 •   Pragma

                     •                  Proxy


                          : no-cache




2010-10-03
HTTP/1.1 Caching




             •   Apache   lighthttpd   Web

             •
             •                               (




2010-10-03
HTTP/1.1 Caching




             •   android.webkit   HTTP/1.1 Caching

             •
             •
             →Apache HttpClient-Cache




2010-10-03
Apache HttpClient-Cache




             •   Apache HttpClient 4.1

             •   HTTP/1.1 Caching

             •         alpha (2010       9   )




2010-10-03
Apache HttpClient-Cache


             •       URL


                 •   http://hc.apache.org/

             •   Subversion URL

                 •   http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient-cache

                 •   jar                              http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/
                             svn get         mvn package


                 •   Revision: 990924                                  (2010-09-05      )   990925          Serialize
                           NotSerializableException


             •   Maven URL

                 •   http://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient-cache/




2010-10-03
Apache HttpClient-Cache



             •   Caching                               : org.apache.http.client.HttpClient
                            : CachingHttpClient

             •                              DefaultHttpClient     CachingHttpClient



             •   Android       Apache HttpClient 4.0                 (
                   )

             •   alpha                                 (                              )




2010-10-03
Apache HttpClient-Cache


             •   Cache             HTTP

                 •   HTTP 1.1

                 •   Method: GET

                 •   No Header: "Pragma"

                 •   No Header: "Cache-Control: no-store"

                 •   No Header: "Cache-Control: no-cache"


             •   ※
                 org.apache.http.impl.client.cache.CacheableRequestPolicy




2010-10-03
Android




             •   Eclipse

             •   Android

             •   Java Build Path Apache HttpClient 4.1   jar




2010-10-03
Android



             •   Apache HttpClient-Cache      HTTP

             •   Cache Data Read/Write

             •
                 •   Cache Data Serialize

                 •
             •   ※org.apache.http.client.cache.HttpCacheStorage




2010-10-03
CachingHttpClient     DefaultHttpClient



                      Expires:
                    Last-Modified:
                                                           281(ms)              122(ms)
                        Etag:
                     File Size: 295 KB
                      Expires:
                    Last-Modified:
                                                            50(ms)              125(ms)
                        Etag:
                      File Size: 4KB
                      Expires:
                    Last-Modified:
                                                           200 (ms)             128 (ms)
                        Etag:
                      File Size: 8KB

             ※HTTP GET              HTTP Response
             ※5
             ※Nexus One (Android 2.2)           Wi-FI
             ※           : http://www1.axfc.net/uploader/Sc/so/154474.zip

2010-10-03
Caching




             →CachingHttpClient#execute()




2010-10-03
•   Apache HttpClient-Cache



             •                                        Caching
                            Caching
                 →   HTTP Response

             •   2010   9

             •                                     HTTP Response
                     Caching      android.webkit




2010-10-03
URL



             •   HTTP/1.1: Caching in HTTP

                 •   http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html

             •               Web

                 •   http://www.atmarkit.co.jp/fjava/rensai2/webopt12/webopt12.html

             •   Android

                 •   http://www.ibm.com/developerworks/jp/opensource/library/os-android-
                     networking/




2010-10-03
•   Web

                 •   http://www.amazon.co.jp/dp/4774142042




2010-10-03

More Related Content

PDF
My complicated WordPress site
PPTX
OpenStack Trove in Production at HP - TroveDay 2014
PDF
Integrated Cache on Netscaler
PPTX
Usenix LISA 2012 - Choosing a Proxy
PPTX
cache concepts and varnish-cache
PDF
Varnish Configuration Step by Step
PDF
EWD 3 Training Course Part 33: Configuring QEWD to use CORS
PDF
Introduction to WebSockets
My complicated WordPress site
OpenStack Trove in Production at HP - TroveDay 2014
Integrated Cache on Netscaler
Usenix LISA 2012 - Choosing a Proxy
cache concepts and varnish-cache
Varnish Configuration Step by Step
EWD 3 Training Course Part 33: Configuring QEWD to use CORS
Introduction to WebSockets

What's hot (20)

PDF
Varnish SSL / TLS
PDF
Scalable Architecture 101
PPTX
Apache Performance Tuning: Scaling Up
PDF
How To Set Up SQL Load Balancing with HAProxy - Slides
PDF
Building your own CDN using Amazon EC2
PDF
Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013
PDF
Caching with Varnish
KEY
Pushing the web — WebSockets
PPTX
Varnish intro
PDF
ReplacingSquidWithATS
PDF
HTTP 2.0 – What do I need to know?
PPTX
WebSocket protocol
PDF
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
PDF
Tomcat openssl
PDF
Advanced Web Hosting
PDF
HTTP/2 (2017)
PDF
Tomcat openssl
KEY
Shiny New HTTP Shit
PDF
Varnish Cache Plus. Random notes for wise web developers
PPTX
Reverse proxy & web cache with NGINX, HAProxy and Varnish
Varnish SSL / TLS
Scalable Architecture 101
Apache Performance Tuning: Scaling Up
How To Set Up SQL Load Balancing with HAProxy - Slides
Building your own CDN using Amazon EC2
Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013
Caching with Varnish
Pushing the web — WebSockets
Varnish intro
ReplacingSquidWithATS
HTTP 2.0 – What do I need to know?
WebSocket protocol
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Tomcat openssl
Advanced Web Hosting
HTTP/2 (2017)
Tomcat openssl
Shiny New HTTP Shit
Varnish Cache Plus. Random notes for wise web developers
Reverse proxy & web cache with NGINX, HAProxy and Varnish
Ad

Similar to 20100918 android cache (20)

PPTX
Building Lightning Fast Websites (for Twin Cities .NET User Group)
PPT
computer networking
PPTX
HTTP/2 Prioritization
PDF
Http2 in practice
PDF
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
PPTX
Choosing A Proxy Server - Apachecon 2014
PDF
Otimizando servidores web
PPTX
REST Methodologies
PPTX
HTTP/2 and web development practices
PDF
Speed Matters
PPTX
A Forgotten HTTP Invisibility Cloak
PDF
Caching on the web
KEY
What's up with HTTP?
PDF
Building & Testing Scalable Rails Applications
PPTX
Http - All you need to know
ODP
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
PDF
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs
PPTX
.NET Conf 2022 - Networking in .NET 7
PDF
Connecting to Web Services on Android June 2 2010
PPT
Top 10 HTML5 Features for Oracle Cloud Developers
Building Lightning Fast Websites (for Twin Cities .NET User Group)
computer networking
HTTP/2 Prioritization
Http2 in practice
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
Choosing A Proxy Server - Apachecon 2014
Otimizando servidores web
REST Methodologies
HTTP/2 and web development practices
Speed Matters
A Forgotten HTTP Invisibility Cloak
Caching on the web
What's up with HTTP?
Building & Testing Scalable Rails Applications
Http - All you need to know
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs
.NET Conf 2022 - Networking in .NET 7
Connecting to Web Services on Android June 2 2010
Top 10 HTML5 Features for Oracle Cloud Developers
Ad

20100918 android cache

  • 1. Android HTTP Cache ( ) 2010-09-18 2010-10-03
  • 2. Android HTTP • java.net • Java • HTTP HttpURLConnection • org.apache.http • Apache HttpClient 4.0 Android • HTTP • android.webkit • Android Android UI Web • HTTP Web 2010-10-03
  • 3. (HTTP ) • Android HTTP (3G 300kbps 2000kbps) • → → → 2010-10-03
  • 4. ( ) • • • ( ) • • →HTTP/1.1 Caching 2010-10-03
  • 5. HTTP/1.1 Caching • RFC2616 • Web Web • HTTP/1.1 Caching HTTP 2010-10-03
  • 6. HTTP/1.1 Caching • HTTP • If-Modified-Since • • If-None-Match • 2010-10-03
  • 7. HTTP/1.1 Caching • HTTP • Expires • • Last-Modified • If-Modified-Since • ETag • If-None- Match 2010-10-03
  • 8. HTTP/1.1 Caching • HTTP • Cache-Control • • Pragma • Proxy : no-cache 2010-10-03
  • 9. HTTP/1.1 Caching • Apache lighthttpd Web • • ( 2010-10-03
  • 10. HTTP/1.1 Caching • android.webkit HTTP/1.1 Caching • • →Apache HttpClient-Cache 2010-10-03
  • 11. Apache HttpClient-Cache • Apache HttpClient 4.1 • HTTP/1.1 Caching • alpha (2010 9 ) 2010-10-03
  • 12. Apache HttpClient-Cache • URL • http://hc.apache.org/ • Subversion URL • http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient-cache • jar http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/ svn get mvn package • Revision: 990924 (2010-09-05 ) 990925 Serialize NotSerializableException • Maven URL • http://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient-cache/ 2010-10-03
  • 13. Apache HttpClient-Cache • Caching : org.apache.http.client.HttpClient : CachingHttpClient • DefaultHttpClient CachingHttpClient • Android Apache HttpClient 4.0 ( ) • alpha ( ) 2010-10-03
  • 14. Apache HttpClient-Cache • Cache HTTP • HTTP 1.1 • Method: GET • No Header: "Pragma" • No Header: "Cache-Control: no-store" • No Header: "Cache-Control: no-cache" • ※ org.apache.http.impl.client.cache.CacheableRequestPolicy 2010-10-03
  • 15. Android • Eclipse • Android • Java Build Path Apache HttpClient 4.1 jar 2010-10-03
  • 16. Android • Apache HttpClient-Cache HTTP • Cache Data Read/Write • • Cache Data Serialize • • ※org.apache.http.client.cache.HttpCacheStorage 2010-10-03
  • 17. CachingHttpClient DefaultHttpClient Expires: Last-Modified: 281(ms) 122(ms) Etag: File Size: 295 KB Expires: Last-Modified: 50(ms) 125(ms) Etag: File Size: 4KB Expires: Last-Modified: 200 (ms) 128 (ms) Etag: File Size: 8KB ※HTTP GET HTTP Response ※5 ※Nexus One (Android 2.2) Wi-FI ※ : http://www1.axfc.net/uploader/Sc/so/154474.zip 2010-10-03
  • 18. Caching →CachingHttpClient#execute() 2010-10-03
  • 19. Apache HttpClient-Cache • Caching Caching → HTTP Response • 2010 9 • HTTP Response Caching android.webkit 2010-10-03
  • 20. URL • HTTP/1.1: Caching in HTTP • http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html • Web • http://www.atmarkit.co.jp/fjava/rensai2/webopt12/webopt12.html • Android • http://www.ibm.com/developerworks/jp/opensource/library/os-android- networking/ 2010-10-03
  • 21. Web • http://www.amazon.co.jp/dp/4774142042 2010-10-03