Skip to content

\Cache::delete_all() using memcached driver not clearing all items #2143

@iturgeon

Description

@iturgeon

I just ran into an issue where delete_all wasn't working as I expected.

The first argument to Cache::delete_all() is $section, with the following description:

Name of a section or directory of the cache, null to delete everything

On fuel/core 1.8.2, I'm getting this behavior using the memcached driver:

\Cache::set('section_name.item', 'value');
\Cache::delete_all(); // expected to remove everything
\Cache::get('section_name.item'); // 'value'

\Cache::delete_all('section_name');
\Cache::get('section_name.item'); // null

Looking at https://github.com/fuel/core/blob/1.8.2/classes/cache/storage/memcached.php#L149

$section is prepended with the configured cache_id.

Then looking at https://github.com/fuel/core/blob/1.8.2/classes/cache/storage/memcached.php#L157

This is the branch for choosing between deleting everything or just the matching section - however, ! empty($section) looks like it can't ever be false because it will always contain the prepended cache_id.

Also note - it won't be an issue if cache.memcached.cache_id is an empty string.

Just checking to see if I'm seeing this correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions