BVB Source Codes

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

Return Download The latest thinkphp v5.2 work order system: download Eaccelerator.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.  * Eaccelerator缓存驱动
  16.  */
  17. class Eaccelerator extends Cache {
  18.  
  19.     /**
  20.      * 架构函数
  21.      * @param array $options 缓存参数
  22.      * @access public
  23.      */
  24.     public function __construct($options=array()) {
  25.         $this->options['expire'] =  isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');
  26.         $this->options['prefix'] =  isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');        
  27.         $this->options['length'] =  isset($options['length'])?  $options['length']  :   0;
  28.     }
  29.  
  30.     /**
  31.      * 读取缓存
  32.      * @access public
  33.      * @param string $name 缓存变量名
  34.      * @return mixed
  35.      */
  36.      public function get($name) {
  37.         N('cache_read',1);
  38.          return eaccelerator_get($this->options['prefix'].$name);
  39.      }
  40.  
  41.     /**
  42.      * 写入缓存
  43.      * @access public
  44.      * @param string $name 缓存变量名
  45.      * @param mixed $value  存储数据
  46.      * @param integer $expire  有效时间(秒)
  47.      * @return boolean
  48.      */
  49.      public function set($name, $value, $expire = null) {
  50.         N('cache_write',1);
  51.         if(is_null($expire)) {
  52.             $expire  =  $this->options['expire'];
  53.         }
  54.         $name   =   $this->options['prefix'].$name;
  55.         eaccelerator_lock($name);
  56.         if(eaccelerator_put($name, $value, $expire)) {
  57.             if($this->options['length']>0) {
  58.                 // 记录缓存队列
  59.                 $this->queue($name);
  60.             }
  61.             return true;
  62.         }
  63.         return false;
  64.      }
  65.  
  66.  
  67.     /**
  68.      * 删除缓存
  69.      * @access public
  70.      * @param string $name 缓存变量名
  71.      * @return boolean
  72.      */
  73.      public function rm($name) {
  74.          return eaccelerator_rm($this->options['prefix'].$name);
  75.      }
  76.  
  77. }
downloadEaccelerator.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