I can't check the source code now, but common sense says it will override
default lifetime settings (1800) in this call with the specific one (3600).

  _____  

De: holografix . [mailto:hologra...@gmail.com] 
Enviado el: martes, 03 de marzo de 2009 16:18
Para: fw-general@lists.zend.com
Asunto: [fw-general] Zend_Cache lifetime question


Hi

Here's some code:

// Setup cache object
$frontendOptions = array(
    'lifetime' => 1800, 
    'automatic_serialization' => true
);

$backendOptions = array(
    'cache_dir' => '../data/cache/' 
);


$cache = Zend_Cache::factory(
    'Core',
    'File',
    $frontendOptions,
    $backendOptions
);

Later when getting data from cache

if (!$data = $cache->load('datafromdb')) {
     // Read data from db
     ...
     
     $cache->save($data, 'datafromdb');
}

The save() method accepts 5 params: data, id, tags, specificLifetime,
priority.

What happens if I tell cache to save this record with a specific lifetime of
3600 seconds?
Will it keep the new lifetime or the 1800 seconds defined in the frontend
options array ?

Thanks in advance.

holo


Reply via email to