I started using Zend Cache (APC backend), and everything is fine in terms of returning cached values, and not to hit the database every time. However, my problem is:
$cache_key = 'getrebates_'.$operator_code; if(PP_Model_CacheService::exists($cache_key)) { $cached_values = PP_Model_CacheService::load($cache_key); } else { //hits the db $cached_values = $this->getAll($operator_code); PP_Model_CacheService::save($cached_values, $cache_key); } return $cached_values;
Each operator has its own discounts that vary between operators, now if I change the database and I need to clear the discounts for all operators, how would I do it?
I can use $ Cache-> clean () , but this will clear the other caches (and not just the discount cache for each statement). If I go through all the operators:
foreach($operator_codes AS $operator_code) { $cache_key = 'getrebates_'.$operator_code; $cache->delete($cache_key) }
It looks like a cache job. Is there a way to clear only part of the cache.
//Something like: $section_key = 'getrebates'; $Cache[$section_key][$operator_code]; $Cache->clearSection($section_key);
Is there any array structure in the APC cache or is it all key-based cache / value?
source share