捌度空间 缓存类(2)


    end property

    public property let expires(tm)
        '重设置过期时间
        expireTime=tm
        application.lock
        application(expireTimeName)=expireTime
        application.unlock
    end property

    public sub add(var,expire)
        '赋值
        if isempty(var) or not isDate(expire) then
            exit sub
        end if
        obj=var
        expireTime=expire
        application.lock
        application(cacheName)=obj
        application(expireTimeName)=expireTime
        application.unlock
    end sub

    public property get value
        '取值
        if isempty(obj) or not isDate(expireTime) then
            value=null
        elseif CDate(expireTime)<now then
            value=null
        else
            value=obj
        end if
    end property

    public sub makeEmpty()
        '释放application
        application.lock
        application(cacheName)=empty
        application(expireTimeName)=empty
        application.unlock
        obj=empty
        expireTime=empty
    end sub

    public function equal(var2)
        '比较
        if typename(obj)<>typename(var2) then
            equal=false

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2907.html