This repository has been archived by the owner on Apr 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
advanced_cache.html
129 lines (106 loc) · 3.32 KB
/
advanced_cache.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mobile Widgets</title>
<link rel="stylesheet" href="style/style.css" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<script type="text/javascript" src="js/StructureElts.js"></script>
<script type="text/javascript" src="js/Structure.js"></script>
<script type="text/javascript" src="js/DocElements.js"></script>
</head>
<body>
<script type="text/javascript">
<!--
idCurrentPage = "advanced_cache";
beginPage();
//-->
</script>
<h1 class="title">caching features</h1>
<script type="text/javascript">
<!--
addIndex();
//-->
</script>
<script type="text/javascript">addTitle("Introduction", 1);</script>
<p>
Cache used to store temporary data on mobile (RSS feed, news, ...). Data are
stored in RMS or in memory.
</p>
<p>
Advantages:
</p>
<ul>
<li>data are loaded only at first access. After, we use the cached data.</li>
<li>cache access are quickly than HTTP or file access.</li>
</ul>
<br/>
<p class="note warning">
<b>Warning:</b><br/>
The cache does not know whether the data are outdated.<br/>
The lifetime of the data must be managed by the developer.
</p>
<p>
Questions on the data to be registered in cache:
<ul>
<li>are the data often accessed by user? if not: registering the data in record store can be useless.</li>
<li>quantity of data? if there is a lot of data: registering them in record store can slow the application.</li>
<li>is the lifecycle of data short? if it is short: you should configure a short cache delay so cache may not be often used</li>
</ul>
</p>
<br/>
<script type="text/javascript">addTitle("Cache access", 1);</script>
<p>
The cache access is done through Javacript APIs.
</p>
<ul>
<li><a href="development_javascript_File.html">File</a></li>
<li><a href="development_javascript_Http.html">Http</a></li>
<li><a href="development_javascript_JSON.html">JSON</a></li>
<li><a href="development_javascript_XML.html">XML</a></li>
</ul>
<br/>
<p>
To use cache, use an URL in two part, separated by a comma.
</p>
<ul>
<li>first part, the cache resource URL (<b>cache://...</b>)</li>
<li>second part, the resource URL (<b>file://...</b>, <b>http://...</b> or other URL)</li>
<li>third part (optional), asynchronous access (a boolean - true = synchronous / false = asynchronous)</li>
</ul>
<br/>
<p>
example:
</p>
<textarea rows="6" cols="80" readonly="readonly" wrap="off">
//File access
File.open ('cache://mypicture.png,file://mypicture.png');
//HTTP loading
Http.get ('cache://mypicture.png,http://server/mypicture.png', on PictureLoaded);
//XML loading
XML.open ('cache://myXmlFile.xml,http://server/myXmlFile.xml', XML.URL, onXmlLoaded);
</textarea>
<br/>
<script type="text/javascript">addTitle("Cache scope", 1);</script>
<p>
The cache is dependent on the widget. A widget cannot read another widget cache.<br/>
The cache scope is the current widget.
</p>
<p>
We cannot reuse data in cache between two widgets.
</p>
<br/>
<script type="text/javascript">
<!--
addBackPageNavigator ('widgets_development_advanced','advanced_inline');
//-->
</script>
<script type="text/javascript">
<!--
endPage();
//-->
</script>
</body>
</html>