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.624 2006/11/07 08:37:07 wellhard Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.625 2006/11/14 16:28:02 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:230:    int hits, misses;       void flush()    {   #ifndef RAM_CACHE_NO_RELOAD_FLUSH    current_size = 0;    cache = ([]);   #endif    }    -  static void low_expire_entry(string key_prefix, array(string) keys) +  static int low_expire_entry(string key_prefix, array(string) keys)    { -  if (!key_prefix) return; +  if (!key_prefix) return 0; +  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++;    }    } -  +  return res;    }       void expire_entry(string key_prefix, RequestID|void id)    {    if (!id) {    low_expire_entry(key_prefix, indices(cache));    return;    }    string url = key_prefix;    sscanf(url, "%[^\0]", url);
Roxen.git/server/base_server/configuration.pike:289:    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++) -  low_expire_entry(q[random(sizeof(q))], q); +  i += low_expire_entry(q[random(sizeof(q))], q);    }       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) {