Skip to content

Commit

Permalink
using the domain cake_error for error messages.
Browse files Browse the repository at this point in the history
These are error message for developers
  • Loading branch information
AD7six committed Mar 19, 2011
1 parent b90939f commit 2fc8d88
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
24 changes: 12 additions & 12 deletions lib/Cake/Cache/Cache.php
Expand Up @@ -22,12 +22,12 @@

/**
* Cache provides a consistent interface to Caching in your application. It allows you
* to use several different Cache engines, without coupling your application to a specific
* implementation. It also allows you to change out cache storage or configuration without effecting
* to use several different Cache engines, without coupling your application to a specific
* implementation. It also allows you to change out cache storage or configuration without effecting
* the rest of your application.
*
* You can configure Cache engines in your application's `bootstrap.php` file. A sample configuration would
* be
* You can configure Cache engines in your application's `bootstrap.php` file. A sample configuration would
* be
*
* {{{
* Cache::config('shared', array(
Expand All @@ -37,7 +37,7 @@
* }}}
*
* This would configure an APC cache engine to the 'shared' alias. You could then read and write
* to that cache alias by using it for the `$config` parameter in the various Cache methods. In
* to that cache alias by using it for the `$config` parameter in the various Cache methods. In
* general all Cache operations are supported by all cache engines. However, Cache::increment() and
* Cache::decrement() are not supported by File caching.
*
Expand Down Expand Up @@ -143,7 +143,7 @@ protected static function _buildEngine($name) {
}
$cacheClass = $class . 'Engine';
if (!is_subclass_of($cacheClass, 'CacheEngine')) {
throw new CacheException(__d('cake', 'Cache engines must use CacheEngine as a base class.'));
throw new CacheException(__d('cake_error', 'Cache engines must use CacheEngine as a base class.'));
}
self::$_engines[$name] = new $cacheClass();
if (self::$_engines[$name]->init($config)) {
Expand Down Expand Up @@ -182,13 +182,13 @@ public static function drop($name) {

/**
* Temporarily change the settings on a cache config. The settings will persist for the next write
* operation (write, decrement, increment, clear). Any reads that are done before the write, will
* use the modified settings. If `$settings` is empty, the settings will be reset to the
* operation (write, decrement, increment, clear). Any reads that are done before the write, will
* use the modified settings. If `$settings` is empty, the settings will be reset to the
* original configuration.
*
* Can be called with 2 or 3 parameters. To set multiple values at once.
*
* `Cache::set(array('duration' => '+30 minutes'), 'my_config');`
* `Cache::set(array('duration' => '+30 minutes'), 'my_config');`
*
* Or to set one value.
*
Expand Down Expand Up @@ -283,7 +283,7 @@ public static function write($key, $value, $config = 'default') {
self::set(null, $config);
if ($success === false && $value !== '') {
trigger_error(
__d('cake', "%s cache was unable to write '%s' to cache", $config, $key),
__d('cake_error', "%s cache was unable to write '%s' to cache", $config, $key),
E_USER_WARNING
);
}
Expand Down Expand Up @@ -357,7 +357,7 @@ public static function increment($key, $offset = 1, $config = 'default') {
*
* @param string $key Identifier for the data
* @param integer $offset How much to substract
* @param string $config Optional string configuration name. Defaults to 'default'
* @param string $config Optional string configuration name. Defaults to 'default'
* @return mixed new value, or false if the data doesn't exist, is not integer,
* or if there was an error fetching it
*/
Expand Down Expand Up @@ -579,4 +579,4 @@ public function key($key) {
$key = Inflector::underscore(str_replace(array(DS, '/', '.'), '_', strval($key)));
return $key;
}
}
}
12 changes: 6 additions & 6 deletions lib/Cake/Cache/Engine/FileEngine.php
Expand Up @@ -37,7 +37,7 @@ class FileEngine extends CacheEngine {

/**
* Settings
*
*
* - path = absolute path to cache directory, default => CACHE
* - prefix = string prefix for filename, default => cake_
* - lock = enable file locking on write, default => false
Expand Down Expand Up @@ -162,7 +162,7 @@ public function read($key) {
if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) {
return false;
}

$data = '';
$this->_File->next();
while ($this->_File->valid()) {
Expand Down Expand Up @@ -251,7 +251,7 @@ public function clear($check) {
* @throws CacheException
*/
public function decrement($key, $offset = 1) {
throw new CacheException(__d('cake', 'Files cannot be atomically decremented.'));
throw new CacheException(__d('cake_error', 'Files cannot be atomically decremented.'));
}

/**
Expand All @@ -261,7 +261,7 @@ public function decrement($key, $offset = 1) {
* @throws CacheException
*/
public function increment($key, $offset = 1) {
throw new CacheException(__d('cake', 'Files cannot be atomically incremented.'));
throw new CacheException(__d('cake_error', 'Files cannot be atomically incremented.'));
}

/**
Expand Down Expand Up @@ -297,9 +297,9 @@ protected function _active() {
$dir = new SplFileInfo($this->settings['path']);
if ($this->_init && !($dir->isDir() && $dir->isWritable())) {
$this->_init = false;
trigger_error(__d('cake', '%s is not writable', $this->settings['path']), E_USER_WARNING);
trigger_error(__d('cake_error', '%s is not writable', $this->settings['path']), E_USER_WARNING);
return false;
}
return true;
}
}
}
14 changes: 7 additions & 7 deletions lib/Cake/Cache/Engine/MemcacheEngine.php
Expand Up @@ -19,7 +19,7 @@
*/

/**
* Memcache storage engine for cache. Memcache has some limitations in the amount of
* Memcache storage engine for cache. Memcache has some limitations in the amount of
* control you have over expire times far in the future. See MemcacheEngine::write() for
* more information.
*
Expand Down Expand Up @@ -61,8 +61,8 @@ public function init($settings = array()) {
return false;
}
parent::init(array_merge(array(
'engine'=> 'Memcache',
'prefix' => Inflector::slug(APP_DIR) . '_',
'engine'=> 'Memcache',
'prefix' => Inflector::slug(APP_DIR) . '_',
'servers' => array('127.0.0.1'),
'compress'=> false
), $settings)
Expand Down Expand Up @@ -115,7 +115,7 @@ function _parseServerString($server) {

/**
* Write data for key into cache. When using memcache as your cache engine
* remember that the Memcache pecl extension does not support cache expiry times greater
* remember that the Memcache pecl extension does not support cache expiry times greater
* than 30 days in the future. Any duration greater than 30 days will be treated as never expiring.
*
* @param string $key Identifier for the data
Expand Down Expand Up @@ -153,7 +153,7 @@ public function read($key) {
public function increment($key, $offset = 1) {
if ($this->settings['compress']) {
throw new CacheException(
__d('cake', 'Method increment() not implemented for compressed cache in %s', __CLASS__)
__d('cake_error', 'Method increment() not implemented for compressed cache in %s', __CLASS__)
);
}
return $this->_Memcache->increment($key, $offset);
Expand All @@ -171,7 +171,7 @@ public function increment($key, $offset = 1) {
public function decrement($key, $offset = 1) {
if ($this->settings['compress']) {
throw new CacheException(
__d('cake', 'Method decrement() not implemented for compressed cache in %s', __CLASS__)
__d('cake_error', 'Method decrement() not implemented for compressed cache in %s', __CLASS__)
);
}
return $this->_Memcache->decrement($key, $offset);
Expand Down Expand Up @@ -212,4 +212,4 @@ public function connect($host, $port = 11211) {
}
return true;
}
}
}

0 comments on commit 2fc8d88

Please sign in to comment.