#010533: ezcCacheManager::getCache throws unfriendly fatal error

Description:

http://ez.no/doc/components/view/trunk/(file)/introduction_Cache.html#a-simple-exampleurl
With the default example, the steps for using cache are:
1) ezcCacheManager::createCache( 'simple', ...);
2) $cache = ezcCacheManager::getCache( 'simple' );

However, the Cache workflow is overly rigid and does not properly account for cases where is is unknown if a cache has already been initialized. Imagine a situation where a series of functions all used and update the same cache. The workflow would look like this:
1) if (!ezcCacheManager::cacheExists('simple')) ezcCacheManager::createCache( 'simple', ...);
2) $cache = ezcCacheManager::getCache( 'simple' );

Of course, the cacheExists function does not currently exist. The desired functionality could currently done using a try...catch but this is not ideal. It would look something like this:
1) try {$cache = ezcCacheManager::getCache( 'simple' );} catch ( Exception $e ) {ezcCacheManager::createCache( 'simple', ...);$cache = ezcCacheManager::getCache( 'simple' );}


Environment:

Operating System: Debian Linux
PHP Version: 5.2.1


Steps to Reproduce:

$cache = ezcCacheManager::getCache( 'simple' );


- Attachments

No attachments for this issue.


- Comments

We should implemented delayed initialization here.

#252077 by Derick Rethans on March 29th, 2007 [Permanent Link]

Implemented in revision 5912.

#253312 by Derick Rethans on August 14th, 2007 [Permanent Link]

- History
Properties
Type Enhancement
Priority Medium
Component Components » Cache
Affects 1.1.4 - Cache 1.1.4
Fix Versions 1.3alpha1 - Cache 1.3alpha1
2007.2alpha1 - eZ components 2007.2alpha1
Reporter Grady Kuhnline
Responsible Derick Rethans
Status 0 Closed
Resolution Implemented
Created March 29th, 2007
Updated August 14th, 2007
Resolved August 14th, 2007
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels