Subversion Repositories Applications.framework

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
464 jpm 1
<!DOCTYPE html>
2
<html>
3
<head>
4
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
	<meta name="generator" content="ApiGen 2.8.0">
6
	<meta name="robots" content="noindex">
7
 
8
	<title>File exemples/services/modules/0.1/ServiceCacheSimple.php | TBFramework - v0.4</title>
9
 
10
	<script type="text/javascript" src="resources/combined.js?4205936287"></script>
11
	<script type="text/javascript" src="elementlist.js?1964084359"></script>
12
	<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360">
13
 
14
</head>
15
 
16
<body>
17
<div id="left">
18
	<div id="menu">
19
		<a href="index.html" title="Overview"><span>Overview</span></a>
20
 
21
 
22
		<div id="groups">
23
			<h3>Packages</h3>
24
			<ul>
25
				<li class="active"><a href="package-Framework.html">Framework</a>
26
						</li>
27
				<li><a href="package-None.html">None</a>
28
						</li>
29
				<li><a href="package-PHP.html">PHP</a>
30
						</li>
31
				<li><a href="package-Utilitaire.html">Utilitaire</a>
32
						</li>
33
			</ul>
34
		</div>
35
 
36
		<hr>
37
 
38
 
39
		<div id="elements">
40
			<h3>Classes</h3>
41
			<ul>
42
				<li><a href="class-Bdd.html">Bdd</a></li>
43
				<li><a href="class-Cache.html">Cache</a></li>
44
				<li><a href="class-CacheSimple.html">CacheSimple</a></li>
45
				<li><a href="class-Chronometre.html">Chronometre</a></li>
46
				<li><a href="class-Cli.html">Cli</a></li>
47
				<li><a href="class-Config.html">Config</a></li>
48
				<li><a href="class-Controleur.html">Controleur</a></li>
49
				<li><a href="class-Debug.html">Debug</a></li>
50
				<li><a href="class-Framework.html">Framework</a></li>
51
				<li><a href="class-GestionnaireException.html">GestionnaireException</a></li>
52
				<li><a href="class-I18n.html">I18n</a></li>
53
				<li><a href="class-Log.html">Log</a></li>
54
				<li><a href="class-MonService.html">MonService</a></li>
55
				<li><a href="class-Registre.html">Registre</a></li>
56
				<li><a href="class-RestClient.html">RestClient</a></li>
57
				<li><a href="class-RestServeur.html">RestServeur</a></li>
58
				<li><a href="class-RestService.html">RestService</a></li>
59
				<li><a href="class-Script.html">Script</a></li>
60
				<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li>
61
				<li class="active"><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li>
62
				<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li>
63
				<li><a href="class-SquelettePhp.html">SquelettePhp</a></li>
64
				<li><a href="class-Url.html">Url</a></li>
65
			</ul>
66
 
67
 
68
 
69
 
70
 
71
		</div>
72
	</div>
73
</div>
74
 
75
<div id="splitter"></div>
76
 
77
<div id="right">
78
<div id="rightInner">
79
	<form id="search">
80
		<input type="hidden" name="cx" value="">
81
		<input type="hidden" name="ie" value="UTF-8">
82
		<input type="text" name="q" class="text">
83
		<input type="submit" value="Search">
84
	</form>
85
 
86
	<div id="navigation">
87
		<ul>
88
			<li>
89
				<a href="index.html" title="Overview"><span>Overview</span></a>
90
			</li>
91
			<li>
92
				<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a>
93
			</li>
94
			<li>
95
				<a href="class-ServiceCacheSimple.html" title="Summary of ServiceCacheSimple"><span>Class</span></a>
96
			</li>
97
		</ul>
98
		<ul>
99
			<li>
100
				<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
101
			</li>
102
			<li>
103
				<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
104
			</li>
105
			<li>
106
				<a href="todo.html" title="Todo list"><span>Todo</span></a>
107
			</li>
108
		</ul>
109
		<ul>
110
		</ul>
111
	</div>
112
 
113
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang">&lt;?php</span>
114
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-keyword1">class</span> <a id="ServiceCacheSimple" href="#ServiceCacheSimple">ServiceCacheSimple</a> <span class="php-keyword1">extends</span> RestService {
115
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a>
116
</span><span id="4" class="l"><a class="l" href="#4"> 4: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_consulter" href="#_consulter">consulter</a>(<span class="php-var">$ressources</span>, <span class="php-var">$parametres</span>) {
117
</span><span id="5" class="l"><a class="l" href="#5"> 5: </a>        <span class="php-comment">// Redéfinition ici mais peut être configuré depuis le fichier config.ini</span>
118
</span><span id="6" class="l"><a class="l" href="#6"> 6: </a>        <span class="php-var">$options</span> = <span class="php-keyword1">array</span>(
119
</span><span id="7" class="l"><a class="l" href="#7"> 7: </a>            <span class="php-quote">'mise_en_cache'</span>              =&gt; <span class="php-keyword1">true</span>,
120
</span><span id="8" class="l"><a class="l" href="#8"> 8: </a>            <span class="php-quote">'stockage_mode'</span>              =&gt; Cache::STOCKAGE_MODE_SIMPLE,
121
</span><span id="9" class="l"><a class="l" href="#9"> 9: </a>            <span class="php-comment">//'stockage_chemin'              =&gt; 'indiquer le chemin du dossier où mettre le cache par défaut utilise Fichier::getDossierTmp()',</span>
122
</span><span id="10" class="l"><a class="l" href="#10">10: </a>            <span class="php-quote">'duree_de_vie'</span>                   =&gt; <span class="php-num">10</span>
123
</span><span id="11" class="l"><a class="l" href="#11">11: </a>        );
124
</span><span id="12" class="l"><a class="l" href="#12">12: </a>        <span class="php-comment">// Le cache Simple utilise le design pattern fabrique pour être généré.</span>
125
</span><span id="13" class="l"><a class="l" href="#13">13: </a>        <span class="php-var">$cache</span> = Cache::fabriquer(Cache::STOCKAGE_MODE_SIMPLE, <span class="php-var">$options</span>);
126
</span><span id="14" class="l"><a class="l" href="#14">14: </a>
127
</span><span id="15" class="l"><a class="l" href="#15">15: </a>        <span class="php-var">$id</span> = <span class="php-quote">'monCache1'</span>; <span class="php-comment">// id de cache de &quot;ce que l'on veut cacher&quot;</span>
128
</span><span id="16" class="l"><a class="l" href="#16">16: </a>        <span class="php-keyword1">if</span> (!(<span class="php-var">$donnees</span> = <span class="php-var">$cache</span>-&gt;charger(<span class="php-var">$id</span>))) {
129
</span><span id="17" class="l"><a class="l" href="#17">17: </a>            <span class="php-var">$donnees</span> = <span class="php-quote">'Mise en cache à : '</span>.<span class="php-keyword2">strftime</span>(<span class="php-quote">'%A %d %B %Y à %H:%M:%S'</span>, <span class="php-keyword2">time</span>()).<span class="php-quote">'&lt;br/&gt;'</span>;
130
</span><span id="18" class="l"><a class="l" href="#18">18: </a>            <span class="php-keyword1">for</span> (<span class="php-var">$i</span> = <span class="php-num">0</span>; <span class="php-var">$i</span> &lt; <span class="php-num">100000</span>; <span class="php-var">$i</span>++) {
131
</span><span id="19" class="l"><a class="l" href="#19">19: </a>                <span class="php-var">$donnees</span> .= <span class="php-var">$i</span>;
132
</span><span id="20" class="l"><a class="l" href="#20">20: </a>            }
133
</span><span id="21" class="l"><a class="l" href="#21">21: </a>            <span class="php-var">$cache</span>-&gt;sauver(<span class="php-var">$donnees</span>, <span class="php-var">$id</span>);
134
</span><span id="22" class="l"><a class="l" href="#22">22: </a>        }
135
</span><span id="23" class="l"><a class="l" href="#23">23: </a>        <span class="php-comment">// Affichage des données</span>
136
</span><span id="24" class="l"><a class="l" href="#24">24: </a>
137
</span><span id="25" class="l"><a class="l" href="#25">25: </a>        <span class="php-keyword1">echo</span> <span class="php-quote">'&lt;hr/&gt;'</span>.<span class="php-var">$donnees</span>.<span class="php-quote">'&lt;hr/&gt;&lt;p&gt;Hors cache : '</span>.<span class="php-keyword2">strftime</span>(<span class="php-quote">'%A %d %B %Y à %H:%M:%S'</span>).<span class="php-quote">'&lt;/p&gt;'</span>;
138
</span><span id="26" class="l"><a class="l" href="#26">26: </a>    }
139
</span><span id="27" class="l"><a class="l" href="#27">27: </a>}
140
</span><span id="28" class="l"><a class="l" href="#28">28: </a></span><span class="xlang">?&gt;</span></code></pre>
141
 
142
	<div id="footer">
143
		TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a>
144
	</div>
145
</div>
146
</div>
147
</body>
148
</html>