Lançado Adianti Framework 7.6!
Clique aqui para saber mais
menu

Adianti Solutions

API

Adianti, Framework, PHP, MVC, Active record, Front controller, IDE, RAD, Web, multiplataforma, geração de código, desenvolvimento rápido, relatórios, formulários, listagens, datagrids, gráficos, banco de dados, padrões de projeto, design patterns API do Adianti Framework.
API Docs
code
Selecione a classe

Source for file TAPCache.php

Documentation is available at TAPCache.php

  1. <?php
  2. namespace Adianti\Registry;
  3.  
  4. use Adianti\Registry\AdiantiRegistryInterface;
  5.  
  6. /**
  7.  * Adianti APC Record Cache
  8.  *
  9.  * @version    7.4
  10.  * @package    registry
  11.  * @author     Pablo Dall'Oglio
  12.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  13.  * @license    http://www.adianti.com.br/framework-license
  14.  */
  15. class TAPCache implements AdiantiRegistryInterface
  16. {
  17.     /**
  18.      * Returns if the service is active
  19.      */
  20.     public static function enabled()
  21.     {
  22.         return extension_loaded('apcu');
  23.     }
  24.     
  25.     /**
  26.      * Store a variable in cache
  27.      * @param $key    Key
  28.      * @param $value  Value
  29.      */
  30.     public static function setValue($key$value)
  31.     {
  32.         return apcu_store(APPLICATION_NAME '_' $keyserialize($value));
  33.     }
  34.     
  35.     /**
  36.      * Get a variable from cache
  37.      * @param $key    Key
  38.      */
  39.     public static function getValue($key)
  40.     {
  41.         return unserialize(apcu_fetch(APPLICATION_NAME '_' $key));
  42.     }
  43.     
  44.     /**
  45.      * Delete a variable from cache
  46.      * @param $key    Key
  47.      */
  48.     public static function delValue($key)
  49.     {
  50.         return apcu_delete(APPLICATION_NAME '_' $key);
  51.     }
  52.     
  53.     /**
  54.      * Clear cache
  55.      */
  56.     public static function clear()
  57.     {
  58.         return apcu_clear_cache();
  59.     }
  60. }