Roxen.git / server / base_server / configuration.pike

version» Context lines:

Roxen.git/server/base_server/configuration.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2004, Roxen IS.   //      // @appears Configuration   //! A site's main configuration    - constant cvs_version = "$Id: configuration.pike,v 1.595 2005/11/24 15:31:06 grubba Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.596 2005/11/24 17:36:50 grubba Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>   #include <request_trace.h>   #include <timers.h>      #define CATCH(P,X) do{mixed e;if(e=catch{X;})report_error("While "+P+"\n"+describe_backtrace(e));}while(0)      // --- Locale defines ---   //<locale-token project="roxen_start"> LOC_S </locale-token>
Roxen.git/server/base_server/configuration.pike:209:    return current_connections;   }      // It's nice to have the name when the rest of __INIT executes.   string name = roxen->bootstrap_info->get();      // Trivial cache (actually, it's more or less identical to the 200+   // lines of C in HTTPLoop. But it does not have to bother with the   // fact that more than one thread can be active in it at once. Also,   // it does not have to delay free until all current connections using - // the cache entry is done...) + // the cache entry are done...)   class DataCache   {    mapping(string:array(string|mapping(string:mixed))) cache = ([]);       int current_size;    int max_size;    int max_file_size;       int hits, misses;    -  +  // FIXME: We ought to have proper varies support here. +  static int host_in_key; +  void need_host_in_key() +  { +  host_in_key = 1; +  } +     void flush()    {   #ifndef RAM_CACHE_NO_RELOAD_FLUSH    current_size = 0;    cache = ([]);   #endif    }       static void clear_some_cache()    {
Roxen.git/server/base_server/configuration.pike:249:       void expire_entry( string url )    {    if( cache[ url ] )    {    current_size -= strlen(cache[url][0]);    m_delete( cache, url );    }    }    -  void set( string url, string data, mapping meta, int expire ) +  void set(string url, string data, mapping meta, int expire, +  string|void host)    {    if( strlen( data ) > max_file_size ) return;    call_out( expire_entry, expire, url );    current_size += strlen( data );    cache[url] = ({ data, meta });    int n;    while( (current_size > max_size) && (n++<10))    clear_some_cache();    }    -  array(string|mapping(string:mixed)) get( string url ) +  array(string|mapping(string:mixed)) get(string url, string|void host)    {    mixed res; -  +  if (host_in_key) { +  url = (host|"") + "\0" + url; +  } else { +  // Forward compat in case host_in_key is enabled later... +  url = "\0" + url; +  }    if( res = cache[ url ] )    hits++;    else    misses++;    return res;    }       void init_from_variables( )    {    max_size = query( "data_cache_size" ) * 1024;