On 02/13/2011 11:29 PM, Graham Leggett wrote:
> On 13 Feb 2011, at 5:08 PM, Ruediger Pluem wrote:
> 
>>> +/*
>>> + * invalidate a specific URL entity in all caches
>>> + *
>>> + * All cached entities for this URL are removed, usually in
>>> + * response to a POST/PUT or DELETE.
>>> + *
>>> + * This function returns OK if at least one entity was found and
>>> + * removed, and DECLINED if no cached entities were removed.
>>> + */
>>> +int cache_invalidate(cache_request_rec *cache, request_rec *r)
>>
>> Why not adjusting cache_remove_url accordingly? It does nearly the
>> same and
>> has the same prototype.
> 
> Nearly the same, but not enough. cache_remove_url() only takes effect if
> a previous cached entry was found, while cache_invalidate() is
> unconditional.

I guess current cache_remove_url has a bug that you correctly pointed to with
cache_invalidate:

    while(list) {
        list->provider->remove_url(h, r);
        list = list->next;
    }

looks wrong because we must pass a provider specific h to each remove_url call.
So I think the

rv = list->provider->open_entity(h, r, cache->key);

step would be needed in remove_url as well, which of course makes


    if (!cache->key) {
        rv = cache_generate_key(r, r->pool, &cache->key);
        if (rv != APR_SUCCESS) {
            return DECLINED;
        }
    }

needed there as well.
Or cache_remove_url should be changed that it only flushes the cache entry in 
the
backend original selected (cache->provider).

Regards

RĂ¼diger

Reply via email to