BVB Source Codes

The latest thinkphp v5.2 work order system Show Apc.class.php Source code

Return Download The latest thinkphp v5.2 work order system: download Apc.class.php Source code - Download The latest thinkphp v5.2 work order system Source code - Type:.php
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. namespace Think\Cache\Driver;
  12. use Think\Cache;
  13. defined('THINK_PATH') or exit();
  14. /**
  15.  * Apc缓存驱动
  16.  */
  17. class Apc extends Cache {
  18.  
  19.     /**
  20.      * 架构函数
  21.      * @param array $options 缓存参数
  22.      * @access public
  23.      */
  24.     public function __construct($options=array()) {
  25.         if(!function_exists('apc_cache_info')) {
  26.             E(L('_NOT_SUPPORT_').':Apc');
  27.         }
  28.         $this->options['prefix']    =   isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');
  29.         $this->options['length']    =   isset($options['length'])?  $options['length']  :   0;        
  30.         $this->options['expire']    =   isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');
  31.     }
  32.  
  33.     /**
  34.      * 读取缓存
  35.      * @access public
  36.      * @param string $name 缓存变量名
  37.      * @return mixed
  38.      */
  39.      public function get($name) {
  40.         N('cache_read',1);
  41.          return apc_fetch($this->options['prefix'].$name);
  42.      }
  43.  
  44.     /**
  45.      * 写入缓存
  46.      * @access public
  47.      * @param string $name 缓存变量名
  48.      * @param mixed $value  存储数据
  49.      * @param integer $expire  有效时间(秒)
  50.      * @return boolean
  51.      */
  52.      public function set($name, $value, $expire = null) {
  53.         N('cache_write',1);
  54.         if(is_null($expire)) {
  55.             $expire  =  $this->options['expire'];
  56.         }
  57.         $name   =   $this->options['prefix'].$name;
  58.         if($result = apc_store($name, $value, $expire)) {
  59.             if($this->options['length']>0) {
  60.                 // 记录缓存队列
  61.                 $this->queue($name);
  62.             }
  63.         }
  64.         return $result;
  65.      }
  66.  
  67.     /**
  68.      * 删除缓存
  69.      * @access public
  70.      * @param string $name 缓存变量名
  71.      * @return boolean
  72.      */
  73.      public function rm($name) {
  74.          return apc_delete($this->options['prefix'].$name);
  75.      }
  76.  
  77.     /**
  78.      * 清除缓存
  79.      * @access public
  80.      * @return boolean
  81.      */
  82.     public function clear() {
  83.         return apc_clear_cache();
  84.     }
  85.  
  86. }
  87.  
downloadApc.class.php Source code - Download The latest thinkphp v5.2 work order system Source code
Related Source Codes/Software:
V3.3.6 Workerman high-performance PHP Socket (framework) - High performance PHP Socket framework Workerman re... 2017-05-03
The phosphor meeting room reservation system MRBS (loop reservation v16.0) - The phosphor meeting room reservation system MRBS ... 2017-05-03
IDC v5.2.3 agent center - IDC Centre IDC for exploitation is a PHP+MySQL age... 2017-05-03
Zen master v9.0.1 project management software - Zen is the first domestic open source project mana... 2017-05-03
Ray speed v7.03 employee files management system - Employee files project is various, and some conten... 2017-05-03
HITCMS Haitian responsive electronic mechanical v3.0 foreign trade website source code - HITCMS Haitian response electronic machinery trade... 2017-05-03
Ray v7.02 speed survey system - Lightning speed survey system is a. NET+MSSQL deve... 2017-05-03
Cool HITCMS reactive black v3.0 enterprise website source code - HITCMS-Haitian response black enterprises website ... 2017-05-03
WebOA v17.2 network office automation system - WebOA network using b/s structure development of o... 2017-05-03
Pure imitation of han site source code, one a 】 【 c9cms kernel v1.0 - Generic http://www.wufazhuce.com/Han one · Config... 2017-05-04
zone.js - Implements Zones for JavaScript ... 2017-05-11
dragonfly - A Ruby gem for on-the-fly processing - suitable fo... 2017-05-11
oh-my-fish - The Fishshell Framework. 2017-05-11
canvas-lms - The open LMS by Instructure, Inc. 2017-05-11
ledger - Double-entry accounting system with a command-line... 2017-05-11
Python - My Python Examples http://w... 2017-05-11
blade - 2017-05-11
LaZagne - Credentials recovery project 2017-05-10
Pull-to-Refresh.Rentals-iOS - This project aims to provide a simple and customiz... 2017-05-10
spoon - Distributing instrumentation tests to all your And... 2017-05-10

 Back to top