Roxen.git/
server/
base_server/
roxen.pike
Branch:
Tag:
Non-build tags
All tags
No tags
2001-09-06
2001-09-06 10:28:52 by Per Hedbor <ph@opera.com>
6789261f23cf4fea34d4402e99a8aa2671d9fdf9 (
48
lines) (+
8
/-
40
)
[
Show
|
Annotate
]
Branch:
5.2
Tentative fix for erronous images
Rev: server/base_server/roxen.pike:1.733
6:
// Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others. // ABS and suicide systems contributed freely by Francesco Chemolli
-
constant cvs_version="$Id: roxen.pike,v 1.
732
2001/09/06
09
:
47
:
11
per Exp $";
+
constant cvs_version="$Id: roxen.pike,v 1.
733
2001/09/06
10
:
28
:
52
per Exp $";
// The argument cache. Used by the image cache. ArgCache argcache;
2676:
QUERY("SELECT meta FROM "+name+" WHERE id=%s", id ); string s;
-
+
if(!sizeof(q) || !strlen(s = q[0]->meta)) return 0;
-
QUERY("UPDATE "+name+" SET atime=UNIX_TIMESTAMP() WHERE id=%s",id );
-
+
mapping m; if (catch (m = decode_value (s))) {
2689:
QUERY( "DELETE FROM "+name+" WHERE id=%s", id); return 0; }
+
+
QUERY("UPDATE "+name+" SET atime=UNIX_TIMESTAMP() WHERE id=%s",id );
return meta_cache_insert( id, m ); }
3036:
#define CLEAN_SIZE 100 static string lq, ulq;
-
#ifdef THREADS
-
Thread.Mutex mutex = Thread.Mutex();
-
#endif
+
-
#ifdef DB_SHARING
-
class DBLock
-
{
+
#ifdef THREADS
-
object key;
-
#endif
-
static void create()
-
{
-
#ifdef THREADS
-
key =
mutex
->lock();
-
#endif
-
if(!lq)
-
{
-
lq
=
"select GET_LOCK
(
'"+name+"', 4
)
"
;
-
ulq = "select RELEASE_LOCK('"+name+"')";
-
}
-
get_db()->query( lq );
-
}
-
static void destroy()
-
{
-
get_db()->query( ulq );
-
#
ifdef
THREADS
-
key = 0;
-
#endif
-
}
-
}
-
#
define LOCK()
DBLock
__ =
DBLock
()
+
Thread.Mutex
mutex =
Thread.Mutex
();
+
# define LOCK()
mixed
__ =
mutex->lock
()
#else
-
#ifdef THREADS
-
Thread.Mutex _mt = Thread.Mutex();
-
# define LOCK() mixed __ = _mt->lock()
-
#else
+
# define LOCK() #endif
-
#endif
+
static mapping (string:mixed) cache = ([ ]);
3226:
//! data later. { array b = values(args), a = sort(indices(args),b);
+
LOCK();
string id = encode_id( low_store( a ), low_store( b ) ); if( !cache[ id ] ) cache[ id ] = args+([]);
3239:
if( mixed q = cache[ hv ] ) return q;
-
LOCK();
+
#ifdef THREADS if( mixed q = cache[ hv ] ) return q;