Talk:Singleton pattern

From Axaptapedia

It maybe slightly shorter

// RunOn:CalledFrom
public static SingletonTest instance()
{
    SingletonTest ret;
    SysGlobalCache cache=infolog.objectOnServer() ? appl.globalCache() : infolog.globalCache();
    ;
    if (cache.isSet(ClassStr(SingletonTest), 0))
        ret = cache.get(ClassStr(SingletonTest), 0);
    else
    {
        ret = new SingletonTest();
        infoLog.globalCache().set(ClassStr(SingletonTest), 0, ret);
        appl.globalCache().set(ClassStr(SingletonTest), 0, ret);
    }

    return ret;
}

Agreed. Change made AJ 05:21, 4 Jan 2006 (PST)