Ejemplo n.º 1
0
function avatarKey($name)
{
    global $debug;
    $cached = getFromCache('name2key', $name);
    if ($cached['value'] != null) {
        return $cached['value'];
    } else {
        $avatarkey = getAvatarKey($name);
        if ($avatarkey != null) {
            if (existsInCache('name2key', $name)) {
                updateInCache('name2key', $name, $avatarkey);
            } else {
                putInCache('name2key', $name, $avatarkey);
            }
            return $avatarkey;
        } else {
            $cached = getForceFromCache('name2key', $name);
            if ($cached['value'] == null) {
                logMessage('rest', 3, 'Response not received.');
                return null;
            } else {
                if ($cached['value'] == 0) {
                    logMessage('db', 1, 'Failed to lookup avatar name for ' . $key);
                    return null;
                } else {
                    logMessage('db', 1, 'Returning old cache entry (' . (time() - $cached['timestamp']) . ')');
                    return $cached['value'];
                }
            }
        }
    }
}
Ejemplo n.º 2
0
function regionMap($sim)
{
    global $debug;
    $cached = getFromCache('regionmap', $key);
    if ($cached['value'] != null) {
        return $cached['value'];
    } else {
        $handle = getRegionMap($sim);
        if ($handle == null) {
            logMessage('rest', 3, 'Response not received.');
            $cached = getForceFromCache('regionmap', $sim);
            if ($cached != null) {
                logMessage('db', 1, 'Returning old cache entry (' . (time() - $cached['timestamp']) . ')');
                return $cached['value'];
            } else {
                return null;
            }
        } else {
            if (existsInCache('regionmap', $sim)) {
                updateInCache('regionmap', $sim, $handle);
            } else {
                putInCache('regionmap', $sim, $handle);
            }
            return $handle;
        }
    }
}