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.625 2006/11/14 16:28:02 grubba Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.626 2006/11/14 16:48:22 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:233: Inside #if undefined(RAM_CACHE_NO_RELOAD_FLUSH)
   {   #ifndef RAM_CACHE_NO_RELOAD_FLUSH    current_size = 0;    cache = ([]);   #endif    }       static int low_expire_entry(string key_prefix, array(string) keys)    {    if (!key_prefix) return 0; +  if (arrayp(cache[key_prefix])) { +  // Leaf node. No need to loop. +  current_size -= sizeof(cache[key_prefix][0]); +  m_delete(cache, key_prefix); +  // keys[] = 0; +  return 1; +  } +  // Inner node. Find all its children.    int res = 0;    foreach(keys; int ind; string key) {    if (!key) continue;    if (has_prefix(key, key_prefix)) {    if (arrayp(cache[key])) {    current_size -= sizeof(cache[key][0]);    }    m_delete(cache, key);    keys[ind] = 0;    res++;
Roxen.git/server/base_server/configuration.pike:291:       static void clear_some_cache()    {    // FIXME: Use random(cache) instead to avoid the indices() call.    array(string) q = indices(cache);    if(!sizeof(q))    {    current_size=0;    return;    } -  for(int i = 0; i < sizeof(q)/10; i++) -  i += low_expire_entry(q[random(sizeof(q))], q); +  for(int i = 0; i < sizeof(q)/10; i++) { +  int r; +  i += low_expire_entry(q[r = random(sizeof(q))], q); +  q[r] = 0;    } -  +  }       void set(string url, string data, mapping meta, int expire, RequestID id)    {    if( strlen( data ) > max_file_size ) return;       string key = url;       foreach(id->misc->vary_cb_order || ({}),    string|function(string, RequestID: string) vary_cb) {    array(string|mapping(string:mixed))|string|