CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 1.3 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 1.3
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Classes

  • AclBase
  • AclBehavior
  • AclComponent
  • AclNode
  • AclShell
  • Aco
  • AcoAction
  • AjaxHelper
  • ApcEngine
  • ApiShell
  • App
  • AppController
  • AppHelper
  • AppModel
  • Aro
  • AuthComponent
  • BakeShell
  • BakeTask
  • BehaviorCollection
  • Cache
  • CacheEngine
  • CacheHelper
  • CakeErrorController
  • CakeLog
  • CakeRoute
  • CakeSchema
  • CakeSession
  • CakeSocket
  • ClassRegistry
  • Component
  • Configure
  • ConnectionManager
  • ConsoleShell
  • ContainableBehavior
  • Controller
  • ControllerTask
  • CookieComponent
  • DataSource
  • DbAcl
  • DbConfigTask
  • DboMssql
  • DboMysql
  • DboMysqlBase
  • DboMysqli
  • DboOracle
  • DboPostgres
  • DboSource
  • DboSqlite
  • Debugger
  • EmailComponent
  • ErrorHandler
  • ExtractTask
  • File
  • FileEngine
  • FileLog
  • FixtureTask
  • Folder
  • FormHelper
  • Helper
  • HtmlHelper
  • HttpSocket
  • I18n
  • I18nModel
  • I18nShell
  • Inflector
  • IniAcl
  • JavascriptHelper
  • JqueryEngineHelper
  • JsBaseEngineHelper
  • JsHelper
  • L10n
  • MagicDb
  • MagicFileResource
  • MediaView
  • MemcacheEngine
  • Model
  • ModelBehavior
  • ModelTask
  • MootoolsEngineHelper
  • Multibyte
  • NumberHelper
  • Object
  • Overloadable
  • Overloadable2
  • PagesController
  • PaginatorHelper
  • Permission
  • PluginShortRoute
  • PluginTask
  • ProjectTask
  • PrototypeEngineHelper
  • RequestHandlerComponent
  • Router
  • RssHelper
  • Sanitize
  • Scaffold
  • ScaffoldView
  • SchemaShell
  • Security
  • SecurityComponent
  • SessionComponent
  • SessionHelper
  • Set
  • Shell
  • String
  • TemplateTask
  • TestSuiteShell
  • TestTask
  • TextHelper
  • ThemeView
  • TimeHelper
  • TranslateBehavior
  • TreeBehavior
  • Validation
  • View
  • ViewTask
  • XcacheEngine
  • Xml
  • XmlElement
  • XmlHelper
  • XmlManager
  • XmlNode
  • XmlTextNode

Functions

  • mb_encode_mimeheader
  • mb_stripos
  • mb_stristr
  • mb_strlen
  • mb_strpos
  • mb_strrchr
  • mb_strrichr
  • mb_strripos
  • mb_strrpos
  • mb_strstr
  • mb_strtolower
  • mb_strtoupper
  • mb_substr
  • mb_substr_count
  1: <?php
  2: /**
  3:  * APC storage engine for cache.
  4:  *
  5:  *
  6:  * PHP versions 4 and 5
  7:  *
  8:  * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  9:  * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 10:  *
 11:  * Licensed under The MIT License
 12:  * Redistributions of files must retain the above copyright notice.
 13:  *
 14:  * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 15:  * @link          http://cakephp.org CakePHP(tm) Project
 16:  * @package       cake
 17:  * @subpackage    cake.cake.libs.cache
 18:  * @since         CakePHP(tm) v 1.2.0.4933
 19:  * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 20:  */
 21: 
 22: /**
 23:  * APC storage engine for cache
 24:  *
 25:  * @package       cake
 26:  * @subpackage    cake.cake.libs.cache
 27:  */
 28: class ApcEngine extends CacheEngine {
 29: 
 30: /**
 31:  * Initialize the Cache Engine
 32:  *
 33:  * Called automatically by the cache frontend
 34:  * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
 35:  *
 36:  * @param array $setting array of setting for the engine
 37:  * @return boolean True if the engine has been successfully initialized, false if not
 38:  * @see CacheEngine::__defaults
 39:  * @access public
 40:  */
 41:     function init($settings = array()) {
 42:         parent::init(array_merge(array('engine' => 'Apc', 'prefix' => Inflector::slug(APP_DIR) . '_'), $settings));
 43:         return function_exists('apc_cache_info');
 44:     }
 45: 
 46: /**
 47:  * Write data for key into cache
 48:  *
 49:  * @param string $key Identifier for the data
 50:  * @param mixed $value Data to be cached
 51:  * @param integer $duration How long to cache the data, in seconds
 52:  * @return boolean True if the data was succesfully cached, false on failure
 53:  * @access public
 54:  */
 55:     function write($key, &$value, $duration) {
 56:         if ($duration == 0) {
 57:             $expires = 0;
 58:         } else {
 59:             $expires = time() + $duration;
 60:         }
 61:         apc_store($key.'_expires', $expires, $duration);
 62:         return apc_store($key, $value, $duration);
 63:     }
 64: 
 65: /**
 66:  * Read a key from the cache
 67:  *
 68:  * @param string $key Identifier for the data
 69:  * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
 70:  * @access public
 71:  */
 72:     function read($key) {
 73:         $time = time();
 74:         $cachetime = intval(apc_fetch($key.'_expires'));
 75:         if ($cachetime !== 0 && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) {
 76:             return false;
 77:         }
 78:         return apc_fetch($key);
 79:     }
 80: 
 81: /**
 82:  * Increments the value of an integer cached key
 83:  *
 84:  * @param string $key Identifier for the data
 85:  * @param integer $offset How much to increment
 86:  * @param integer $duration How long to cache the data, in seconds
 87:  * @return New incremented value, false otherwise
 88:  * @access public
 89:  */
 90:     function increment($key, $offset = 1) {
 91:         return apc_inc($key, $offset);
 92:     }
 93: 
 94: /**
 95:  * Decrements the value of an integer cached key
 96:  *
 97:  * @param string $key Identifier for the data
 98:  * @param integer $offset How much to substract
 99:  * @param integer $duration How long to cache the data, in seconds
100:  * @return New decremented value, false otherwise
101:  * @access public
102:  */
103:     function decrement($key, $offset = 1) {
104:         return apc_dec($key, $offset);
105:     }
106: 
107: /**
108:  * Delete a key from the cache
109:  *
110:  * @param string $key Identifier for the data
111:  * @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
112:  * @access public
113:  */
114:     function delete($key) {
115:         return apc_delete($key);
116:     }
117: 
118: /**
119:  * Delete all keys from the cache
120:  *
121:  * @return boolean True if the cache was succesfully cleared, false otherwise
122:  * @access public
123:  */
124:     function clear() {
125:         return apc_clear_cache('user');
126:     }
127: }
128: 
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs