Branch: Tag:

1999-05-30

1999-05-30 22:43:30 by Per Hedbor <ph@opera.com>

Fix for the sql-argument cache code. Now it probably even works.

Rev: server/base_server/roxen.pike:1.291

1:   /* -  * $Id: roxen.pike,v 1.290 1999/05/26 14:20:00 grubba Exp $ +  * $Id: roxen.pike,v 1.291 1999/05/30 22:43:30 per Exp $    *    * The Roxen Challenger main program.    *
7:    */      // ABS and suicide systems contributed freely by Francesco Chemolli - constant cvs_version="$Id: roxen.pike,v 1.290 1999/05/26 14:20:00 grubba Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.291 1999/05/30 22:43:30 per Exp $";      object backend_thread;   object argcache;
2223:    {    if( is_db )    { -  mapping res = db->query("select id from "+name+" where id='"+id+"'"); +  mapping res = db->query("select contents from "+name+" where id='"+id+"'");    if( sizeof(res) )    {    db->query("update "+name+" set atime='"+
2283:    string store( mapping args )    {    LOCK(); -  int e = gethrtime(); +     array b = values(args), a = sort(indices(args),b);    string data = MIME.encode_base64(encode_value(({a,b})),1); -  +     if( cache[ data ] )    return cache[ data ][ CACHE_SKEY ];    -  + // werror(" store -> ");    string id = create_key( data ); -  + // werror(id+"\n");    cache[ data ] = ({ 0, 0 });    cache[ data ][ CACHE_VALUE ] = copy_value( args );    cache[ data ][ CACHE_SKEY ] = id;
2308:    mapping lookup( string id )    {    LOCK(); + // werror(" lookup -> "+id+"\n");    if(cache[id])    return cache[cache[id]][CACHE_VALUE];