Back to WincacheStorage class

Method clean

public bool
clean
(mixed $group, mixed $mode = null)
Clean cache for a group given a mode.
Parameters
  • string $group The cache data group
  • string $mode The mode for cleaning cache [group|notgroup]
Returns
  • bool
Since
  • 1.7.0

Method clean - Source code

/**
 * Clean cache for a group given a mode.
 *
 * group mode    : cleans all cache in the group
 * notgroup mode : cleans all cache not in the group
 *
 * @param   string  $group  The cache data group
 * @param   string  $mode   The mode for cleaning cache [group|notgroup]
 *
 * @return  boolean
 *
 * @since   1.7.0
 */
public function clean($group, $mode = null)
{
    $allinfo = wincache_ucache_info();
    $keys = $allinfo['ucache_entries'];
    $secret = $this->_hash;
    foreach ($keys as $key) {
        if (strpos($key['key_name'], $secret . '-cache-' . $group . '-') === 0 xor $mode !== 'group') {
            wincache_ucache_delete($key['key_name']);
        }
    }
    return true;
}