Zend Framework

Zend_Cache clean() does not work

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.1
  • Fix Version/s: 1.9.3
  • Component/s: Zend_Cache
  • Labels:
    None

Description

I'm trying to remove a cache with a specific tag. the clean()-method returns true, but the cache file gets not deleted or cleared.

How I save the cache: Someone is looking at a database record over a controller, i'm generating a individualy cache-id with some params. I start a new cache block and call it with $cache->end(array('tag', 'tag2'); When I'm going to save the existing database record i want to delete the cache. So I build up a new instance of the cache object in my model, and search for matching cache-ids.

my code looks like this:

$cacheIds = $cache->getIdsMatchingTags(array($this->getId()));
foreach ($cacheIds as $cacheId) {
    $cache->remove($cacheId);
}

I don't know what to do else? I think that is a problem with Zend_Cache, r/w permissions are set cause i can write the cache on the given path.

Activity

Hide
Satoru Yoshida added a comment -

Can you specify your Backend type and options? i.e. Xcache, Memcache , File etc.

Show
Satoru Yoshida added a comment - Can you specify your Backend type and options? i.e. Xcache, Memcache , File etc.
Hide
Eduard Zintz added a comment -

<frontend>Output</frontend>
<frontendOptions>
<caching>1</caching>
<lifetime>86400</lifetime>
<cache_id_prefix>blocks_</cache_id_prefix>
<automatic_serialization>1</automatic_serialization>
</frontendOptions>
<backend>File</backend>
<backendOptions>
<cache_dir>/var/cache/technikboerse/blocks</cache_dir>
<hashed_directory_level>2</hashed_directory_level>
</backendOptions>

$config = Zend_Registry::get('config')->cache;
$cache = Zend_Cache::factory(
$config->frontend,
$config->backend,
$config->frontendOptions->toArray(),
$config->backendOptions->toArray());

Show
Eduard Zintz added a comment - <frontend>Output</frontend> <frontendOptions> <caching>1</caching> <lifetime>86400</lifetime> <cache_id_prefix>blocks_</cache_id_prefix> <automatic_serialization>1</automatic_serialization> </frontendOptions> <backend>File</backend> <backendOptions> <cache_dir>/var/cache/technikboerse/blocks</cache_dir> <hashed_directory_level>2</hashed_directory_level> </backendOptions> $config = Zend_Registry::get('config')->cache; $cache = Zend_Cache::factory( $config->frontend, $config->backend, $config->frontendOptions->toArray(), $config->backendOptions->toArray());
Hide
Satoru Yoshida added a comment -

I think this issue may be similar to ZF-5740.

I suggest the following code:

$result = ($result) && $this->remove($id);

should be:

$res = $this->remove($id);
$result = $result && $res;

or

$result = $this->remove($id) && $result;
Show
Satoru Yoshida added a comment - I think this issue may be similar to ZF-5740. I suggest the following code:
$result = ($result) && $this->remove($id);
should be:
$res = $this->remove($id);
$result = $result && $res;
or
$result = $this->remove($id) && $result;
Hide
Satoru Yoshida added a comment -

Solved in SVN r17867

Show
Satoru Yoshida added a comment - Solved in SVN r17867

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: