Subversion Repositories Applications.framework

Rev

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

<!DOCTYPE html>
<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="generator" content="ApiGen 2.8.0">
        <meta name="robots" content="noindex">

        <title>File exemples/services/modules/0.1/ServiceCacheSimple.php | TBFramework - v0.4</title>

        <script type="text/javascript" src="resources/combined.js?4205936287"></script>
        <script type="text/javascript" src="elementlist.js?1964084359"></script>
        <link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360">

</head>

<body>
<div id="left">
        <div id="menu">
                <a href="index.html" title="Overview"><span>Overview</span></a>


                <div id="groups">
                        <h3>Packages</h3>
                        <ul>
                                <li class="active"><a href="package-Framework.html">Framework</a>
                                                </li>
                                <li><a href="package-None.html">None</a>
                                                </li>
                                <li><a href="package-PHP.html">PHP</a>
                                                </li>
                                <li><a href="package-Utilitaire.html">Utilitaire</a>
                                                </li>
                        </ul>
                </div>

                <hr>


                <div id="elements">
                        <h3>Classes</h3>
                        <ul>
                                <li><a href="class-Bdd.html">Bdd</a></li>
                                <li><a href="class-Cache.html">Cache</a></li>
                                <li><a href="class-CacheSimple.html">CacheSimple</a></li>
                                <li><a href="class-Chronometre.html">Chronometre</a></li>
                                <li><a href="class-Cli.html">Cli</a></li>
                                <li><a href="class-Config.html">Config</a></li>
                                <li><a href="class-Controleur.html">Controleur</a></li>
                                <li><a href="class-Debug.html">Debug</a></li>
                                <li><a href="class-Framework.html">Framework</a></li>
                                <li><a href="class-GestionnaireException.html">GestionnaireException</a></li>
                                <li><a href="class-I18n.html">I18n</a></li>
                                <li><a href="class-Log.html">Log</a></li>
                                <li><a href="class-MonService.html">MonService</a></li>
                                <li><a href="class-Registre.html">Registre</a></li>
                                <li><a href="class-RestClient.html">RestClient</a></li>
                                <li><a href="class-RestServeur.html">RestServeur</a></li>
                                <li><a href="class-RestService.html">RestService</a></li>
                                <li><a href="class-Script.html">Script</a></li>
                                <li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li>
                                <li class="active"><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li>
                                <li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li>
                                <li><a href="class-SquelettePhp.html">SquelettePhp</a></li>
                                <li><a href="class-Url.html">Url</a></li>
                        </ul>





                </div>
        </div>
</div>

<div id="splitter"></div>

<div id="right">
<div id="rightInner">
        <form id="search">
                <input type="hidden" name="cx" value="">
                <input type="hidden" name="ie" value="UTF-8">
                <input type="text" name="q" class="text">
                <input type="submit" value="Search">
        </form>

        <div id="navigation">
                <ul>
                        <li>
                                <a href="index.html" title="Overview"><span>Overview</span></a>
                        </li>
                        <li>
                                <a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a>
                        </li>
                        <li>
                                <a href="class-ServiceCacheSimple.html" title="Summary of ServiceCacheSimple"><span>Class</span></a>
                        </li>
                </ul>
                <ul>
                        <li>
                                <a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
                        </li>
                        <li>
                                <a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
                        </li>
                        <li>
                                <a href="todo.html" title="Todo list"><span>Todo</span></a>
                        </li>
                </ul>
                <ul>
                </ul>
        </div>

<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang">&lt;?php</span> 
</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 {
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a>    
</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>) {
</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>
</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>(
</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>,
</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,
</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>
</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>
</span><span id="11" class="l"><a class="l" href="#11">11: </a>        );
</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>
</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>);
</span><span id="14" class="l"><a class="l" href="#14">14: </a>        
</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>
</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>))) {
</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>;
</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>++) {
</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>;
</span><span id="20" class="l"><a class="l" href="#20">20: </a>            }
</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>);
</span><span id="22" class="l"><a class="l" href="#22">22: </a>        }
</span><span id="23" class="l"><a class="l" href="#23">23: </a>        <span class="php-comment">// Affichage des données</span>
</span><span id="24" class="l"><a class="l" href="#24">24: </a>        
</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>;
</span><span id="26" class="l"><a class="l" href="#26">26: </a>    }    
</span><span id="27" class="l"><a class="l" href="#27">27: </a>}
</span><span id="28" class="l"><a class="l" href="#28">28: </a></span><span class="xlang">?&gt;</span></code></pre>

        <div id="footer">
                TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a>
        </div>
</div>
</div>
</body>
</html>