Check-in [bc0159264b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implemented the webservice using memcached
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bc0159264bc5a6dcf53f4dd2c6a465bf698638fa
User & Date: densch 2015-04-17 03:20:51.155
Context
2015-04-17
18:19
Removed apc-related file that's no longer needed Leaf check-in: 39281542d0 user: densch tags: trunk
03:20
Implemented the webservice using memcached check-in: bc0159264b user: densch tags: trunk
02:46
Added client implementation check-in: 4184e47799 user: densch tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to rcmobiesp/webservice/index.php.
16
17
18
19
20
21
22


23
24

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

if (!preg_match('/^(Detect[A-Za-z]+\|*)+$/', $_GET['methods'])) {
    exit(json_encode(array('Error'=> 'No valid methods specified')));
}

$user = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['HTTP_ACCEPT'] . $_GET['methods'];



if (apc_exists($user)) {
    $r = apc_fetch($user);

    $time_end = microtime(true);
    $time = $time_end - $time_start;
    log_msg("cached result: $r took $time seconds");
} else {
    require('MobileESPWebservice.inc');

    $main = new MobileESPWebservice();
    if ($main) {
        $r = $main->toJSON();
    }
    apc_add($user, $r);
    $time_end = microtime(true);
    $time = $time_end - $time_start;
    log_msg("new result: $r took $time seconds");
}

echo $r;








>
>
|
|
>










|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

if (!preg_match('/^(Detect[A-Za-z]+\|*)+$/', $_GET['methods'])) {
    exit(json_encode(array('Error'=> 'No valid methods specified')));
}

$user = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['HTTP_ACCEPT'] . $_GET['methods'];

$m = new Memcached();
$m->addServer('localhost', 11211);

$r = $m->get($user);
if ($r) {
    $time_end = microtime(true);
    $time = $time_end - $time_start;
    log_msg("cached result: $r took $time seconds");
} else {
    require('MobileESPWebservice.inc');

    $main = new MobileESPWebservice();
    if ($main) {
        $r = $main->toJSON();
    }
    $m->set($user, $r);
    $time_end = microtime(true);
    $time = $time_end - $time_start;
    log_msg("new result: $r took $time seconds");
}

echo $r;