pangu http业务层适配cache client接口的更新。
This commit is contained in:
@@ -408,7 +408,13 @@ void cache_pending_ctx_free_cb(void* p)
|
||||
{
|
||||
struct cache_pending_context* ctx=(struct cache_pending_context*)p;
|
||||
ctx->request=NULL;
|
||||
free(ctx->url);
|
||||
FREE(&(ctx->url));
|
||||
FREE(&(ctx->req_if_modified_since));
|
||||
FREE(&(ctx->req_if_none_match));
|
||||
if(ctx->f_tango_cache_fetch)
|
||||
{
|
||||
future_destroy(ctx->f_tango_cache_fetch);
|
||||
}
|
||||
free(ctx);
|
||||
return;
|
||||
}
|
||||
@@ -519,8 +525,13 @@ enum cache_pending_result web_cache_async_pending(struct cache_handle* handle, u
|
||||
promise_set_ctx(p, ctx, cache_pending_ctx_free_cb);
|
||||
|
||||
ATOMIC_INC(&(handle->stat_val[STAT_CACHE_PENDING]));
|
||||
ctx->f_tango_cache_fetch=future_create("_cache_meta", cache_query_meta_on_succ, cache_query_meta_on_fail, p);
|
||||
ctx->f_tango_cache_fetch=future_create("_cache_pend", cache_query_meta_on_succ, cache_query_meta_on_fail, p);
|
||||
int ret=tango_cache_head_object(handle->clients[thread_id], ctx->f_tango_cache_fetch, &meta);
|
||||
if(ret<0)
|
||||
{
|
||||
cache_pending_ctx_free_cb(ctx);
|
||||
return PENDING_RESULT_FOBIDDEN;
|
||||
}
|
||||
assert(ret==0);
|
||||
return PENDING_RESULT_REVALIDATE;
|
||||
}
|
||||
@@ -555,7 +566,12 @@ int web_cache_async_query(struct cache_handle* handle, unsigned int thread_id,
|
||||
|
||||
ATOMIC_INC(&(handle->stat_val[STAT_CACHE_QUERYING]));
|
||||
query_ctx->f_tango_cache_fetch=future_create("_cache_get", cache_query_obj_on_succ, cache_query_obj_on_fail, p);
|
||||
int ret=tango_cache_fetch_object(handle->clients[thread_id], query_ctx->f_tango_cache_fetch, &meta);
|
||||
int ret=tango_cache_fetch_object(handle->clients[thread_id], query_ctx->f_tango_cache_fetch, &meta);
|
||||
if(ret<0)
|
||||
{
|
||||
cache_query_ctx_free_cb(query_ctx);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
struct wrap_cache_put_ctx
|
||||
@@ -658,7 +674,6 @@ struct cache_update_context* web_cache_update_start(struct cache_handle* handle,
|
||||
if(write_ctx==NULL)//exceed maximum cache memory size.
|
||||
{
|
||||
wrap_cache_put_ctx_free(_cache_put_ctx);
|
||||
assert(0);
|
||||
return NULL;
|
||||
}
|
||||
TFE_LOG_DEBUG(handle->logger, "cache upload allowed: %s", _cache_put_ctx->url);
|
||||
|
||||
Reference in New Issue
Block a user