Exemplo n.º 1
0
/**
 * When we're sending an ascii response line back upstream to
 * an ascii protocol client, keep the front_cache sync'ed.
 */
void cproxy_del_front_cache_key_ascii_response(downstream *d,
        char *response,
        char *command) {
    assert(d);
    assert(d->ptd);
    assert(d->ptd->proxy);
    assert(response);

    if (!mcache_started(&d->ptd->proxy->front_cache)) {
        return;
    }

    // TODO: Not sure if we need all these checks, or just
    // clear the cache item no matter what.
    //
    if (strncmp(response, "DELETED", 7) == 0 ||
            strncmp(response, "STORED", 6) == 0 ||
            strncmp(response, "EXISTS", 6) == 0 ||
            strncmp(response, "NOT_FOUND", 9) == 0 ||
            strncmp(response, "NOT_STORED", 10) == 0 ||
            strncmp(response, "ERROR", 5) == 0 ||
            strncmp(response, "SERVER_ERROR", 12) == 0 ||
            (response[0] == '-') ||
            (response[0] >= '0' && response[0] <= '9')) {
        cproxy_del_front_cache_key_ascii(d, command);
    }
}
Exemplo n.º 2
0
void cproxy_del_front_cache_key_ascii(downstream *d,
                                      char *command) {
    assert(d);
    assert(d->ptd);
    assert(d->ptd->proxy);

    if (d->ptd->behavior_pool.base.front_cache_lifespan == 0) {
        return;
    }

    if (mcache_started(&d->ptd->proxy->front_cache)) {
        char *spc = strchr(command, ' ');
        if (spc != NULL) {
            char *key = spc + 1;
            int   key_len = skey_len(key);
            if (key_len > 0) {
                mcache_delete(&d->ptd->proxy->front_cache,
                              key, key_len);

                if (settings.verbose > 2) {
                    moxi_log_write("front_cache del %s\n", key);
                }
            }
        }
    }
}
Exemplo n.º 3
0
void cproxy_del_front_cache_key_ascii(downstream *d,
                                      char *command) {
    assert(d);
    assert(d->ptd);
    assert(d->ptd->proxy);

    if (d->ptd->behavior_pool.base.front_cache_lifespan == 0) {
        return;
    }

    if (mcache_started(&d->ptd->proxy->front_cache)) {
        char *spc = strchr(command, ' ');
        if (spc != NULL) {
            char *key = spc + 1;
            int   key_len = skey_len(key);

            cproxy_front_cache_delete(d->ptd, key, key_len);
        }
    }
}