Skip to content

Commit

Permalink
[docs] Firefox desktop caches for 4 hours now.
Browse files Browse the repository at this point in the history
  • Loading branch information
glogiotatidis committed Apr 28, 2015
1 parent 1c56b58 commit 1b846c7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ How are snippets retrieved by Firefox?
:caption: Flowchart illustrating the process of downloading a snippet.

load_abouthome[label="User loads\nabout:home"];
check_cache_timeout[label="Has it been\n24 hours since\nsnippets were fetched?" shape=diamond];
check_cache_timeout[label="Has it been\n4 hours since\nsnippets were fetched?" shape=diamond];
load_cached_snippets[label="Retrieve snippets from\nIndexedDB" shape=rectangle];
fetch_snippets[label="Fetch snippets from\nsnippets.mozilla.com" shape=rectangle];
store_snippets[label="Store new snippets in\nIndexedDB" shape=rectangle];
Expand All @@ -50,20 +50,22 @@ How are snippets retrieved by Firefox?
load_cached_snippets -> insert_snippets;

Firefox maintains a cache of snippet code downloaded from the Snippet Service
for at least 24 hours since the last download. The cache (and a few other
for at least 4 hours since the last download. The cache (and a few other
useful pieces of information) are stored in IndexedDB, and can be accessed by
code on about:home using a global JavaScript object named ``gSnippetsMap``.

When a user visits about:home, Firefox checks to see when it last downloaded
new snippet code. If it has been at least 24 hours, Firefox requests new
new snippet code. If it has been at least 4 hours, Firefox requests new
snippet code from the Snippet Service and stores it in the cache along with
the current time. After this, or if it hasn't been 24 hours, Firefox loads the
the current time. After this, or if it hasn't been 4 hours, Firefox loads the
snippet code from the cache and injects it directly into about:home.

.. note:: All Firefox does is download snippet code from the service and inject
it into the page. The rest of the logic behind displaying snippets is
determined by the snippet code itself, as explained in the next section.

.. note:: Firefox for Android caches snippets for 24 hours.

.. seealso::

`aboutHome.js <http://dxr.mozilla.org/mozilla-central/source/browser/base/content/abouthome/aboutHome.js>`_
Expand Down Expand Up @@ -112,4 +114,3 @@ Once the code is injected, the included JavaScript:

If no snippets are available, the code falls back to showing default snippets
included within Firefox itself.

0 comments on commit 1b846c7

Please sign in to comment.