--- parser3/src/classes/op.C 2002/02/01 15:02:26 1.62.2.1.2.3 +++ parser3/src/classes/op.C 2001/12/19 16:17:26 1.65 @@ -4,11 +4,10 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://paf.design.ru) - $Id: op.C,v 1.62.2.1.2.3 2002/02/01 15:02:26 paf Exp $ + $Id: op.C,v 1.65 2001/12/19 16:17:26 paf Exp $ */ #include "classes.h" -#include "pa_config_includes.h" #include "pa_common.h" #include "pa_request.h" #include "pa_vint.h" @@ -379,8 +378,7 @@ String *cache_get(Pool& pool, const Stri if(!file_read(pool, file_spec, data, data_size, false/*as_text*/, - false/*fail_on_read_problem*/) - || !data_size/* ignore reads which are empty due to lockEX/lockSH problem */) + false/*fail_on_read_problem*/)) return 0; Data_string_serialized_prolog& prolog= @@ -389,8 +387,7 @@ String *cache_get(Pool& pool, const Stri if(data_sizeas_string(0, "key must be string"); + const String &file_spec=r.absolute(params->as_string(0, "filespec must be string")); + if(params->size()==1) { // delete + cache_delete(pool, file_spec); + return; + } + time_t lifespan=(time_t)params->as_double(1, "lifespan must be number", r); Value& body_code=params->as_junction(2, "body must be code"); @@ -489,8 +490,9 @@ MOP::MOP(Pool& apool) : Methoded(apool), add_native_method("connect", Method::CT_ANY, _connect, 2, 2); + // ^cache[file_spec] delete cache // ^cache[file_spec](time){code} time=0 no cache - add_native_method("cache", Method::CT_ANY, _cache, 3, 3); + add_native_method("cache", Method::CT_ANY, _cache, 1, 3); // switch