i started using zend cache (apc backend) , in terms of returning cached values instead of hitting database each time. however, heres problem:
$cache_key = 'getrebates_'.$operator_code; if(pp_model_cacheservice::exists($cache_key)) { $cached_values = pp_model_cacheservice::load($cache_key); } else { //hits db $cached_values = $this->getall($operator_code); pp_model_cacheservice::save($cached_values, $cache_key); } return $cached_values;
each operator has own rebates vary between operators, if change database , need clear rebates operators, how this?
i can use $cache->clean(), clear other caches (not rebate cache each operator). if loop through operators:
foreach($operator_codes $operator_code) { $cache_key = 'getrebates_'.$operator_code; $cache->delete($cache_key) }
that seems alot of work cache. there way clear section of cache.
//something like: $section_key = 'getrebates'; $cache[$section_key][$operator_code]; $cache->clearsection($section_key);
is there array structure apc cache or cache key/value based?
you can apply tags values stored in cache. way can delete cache entries have tag.
$cache->save($huge_data, 'myuniqueid', array('taga', 'tagb')); // clear cache entries tag taga or tagc $cache->clean( zend_cache::cleaning_mode_matching_tag, array('taga', 'tagc') );
refer page: http://framework.zend.com/manual/en/zend.cache.theory.html , api details clean method of zend_cache_core: http://framework.zend.com/apidoc/1.11/
Comments
Post a Comment