ZF-11677: CLONE - Zend_Application_Resource_Multidb with CacheManager doesn't cache

Description

I have configured Multidb with CacheManager as per documentation (see below). No errors in logs, full access to filesystem, everything should work like charm, the only problem is that no cache is created...


;1) CacheManager configuration:
resources.cachemanager.database.frontend.name = Core
resources.cachemanager.database.frontend.customFrontendNaming = false
resources.cachemanager.database.frontend.options.lifetime = 7200
resources.cachemanager.database.frontend.options.automatic_serialization = true
resources.cachemanager.database.backend.name = File
resources.cachemanager.database.backend.customBackendNaming = false
resources.cachemanager.database.backend.options.cache_dir = APPLICATION_PATH "/../temp/cache"
resources.cachemanager.database.frontendBackendAutoload = false

;2) Multidb configuration:
resources.multidb.defaultMetadataCache = "database"

resources.multidb.db1.adapter = "pdo_mysql"
resources.multidb.db1.host = "localhost"
resources.multidb.db1.username = "webuser"
resources.multidb.db1.password = "XXXX"
resources.multidb.db1.dbname = "db1"
resources.multidb.db1.default = true

resources.multidb.db2.adapter = "pdo_pgsql"
resources.multidb.db2.host = "example.com"
resources.multidb.db2.username = "dba"
resources.multidb.db2.password = "notthatpublic"
resources.multidb.db2.dbname = "db2"

Comments

Why this issue was closed? It is not fixed at all... I am expecting caching files to be created in APPLICATION_PATH "/../temp/cache", but instead it does nothing!

And I'm expected information more detailed, something this line see http://tinyurl.com/HowToReportABug. Also I wonder what was your error for the reproduction https://gist.github.com/1129015, Please try reproduced with this, but I need of a response of your reproduction.

Greetings Ramon

THIS IS THE SCRIPT THAT I HAVE RUN ON MY ENVIRONMENT:

<?php //@see ZF-10543

// Set default timezone date_default_timezone_set('America/New_York');

// Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(FILE) . '/application'));

// Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( realpath(APPLICATION_PATH . '/../library'), get_include_path(), )));

require_once 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance();

$application = new Zend_Application('production', './application/configs/application.ini'); $application->getBootstrap() ->setContainer(Zend_Registry::getInstance()) ->bootstrap();

_setupTable(); _asserts();

function _setupTable() { global $db1, $db2;

$sql = 'CREATE TABLE zf11636(issue integer PRIMARY KEY);';
$multiDB = Zend_Registry::get('multidb');

$db1 = $multiDB->getDb('db1');
$db2 = $multiDB->getDb('db2');

_dropTable();

$db1->query($sql);
$db2->query($sql);

}

function _asserts() { global $db1, $db2;

$cacheManager = Zend_Registry::get('cachemanager');
$cache = $cacheManager->getCache('database');

$tableDb1 = new Zend_Db_Table(array('db' => $db1, 'name' => 'zf11636'));
$tableDb2 = new Zend_Db_Table(array('db' => $db2, 'name' => 'zf11636'));

// caching metadata
$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
$tableDb1->info(Zend_Db_Table::COLS);
$tableDb2->info(Zend_Db_Table::COLS);

assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 1);
assert(Zend_Db_Table::getDefaultMetadataCache() == $cache);
assert(4 == iterator_count(new RecursiveDirectoryIterator("./temp/cache")));

$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
_dropTable();

}

function _dropTable() { global $db1, $db2; try { $db1->query('DROP TABLE zf11636'); } catch (Exception $e) {

}

try {
    $db2->query('DROP TABLE zf11636');
} catch (Exception $e) {

}

}

THIS IS THE OUTPUT THAT I AM SEEING:

Warning: assert(): Assertion failed in C:\Eugene\localhost\Billing\testing.php on line 70

Call Stack: 0.0098 357832 1. {main}() C:\Eugene\localhost\Billing\testing.php:0 0.2185 5536704 2. _asserts() C:\Eugene\localhost\Billing\testing.php:34 0.2543 5545536 3. assert() C:\Eugene\localhost\Billing\testing.php:70

@Eugene Thanks by your response ;). I did change in script https://gist.github.com/1129015 added constant DIR_CACHE, change to your directory cache. The expected of your feedback ;).

Since already thank you. Greetings Ramon

Sure! Please give me couple of days as I'm now traveling and will be back soon...

Please use tag code : this improves the reading.

Same thing:


Warning: assert(): Assertion failed in C:\Eugene\localhost\Billing\testing.php on line 72

Sorry the delay to response. But I was really busy. You can verify the dir_cache is writable (is_writable) or simulate in another enviroment to verify the diff (if this fine work).

Greetings Ramon

Need of more information about last comment. Case persist this problem feel free to reopen ;).

Greetings, Ramon