powered by Jive Software

PROPOSAL: variable vCard cache flush interval

What do you guys think about making the interval on which the vCard cache is flushed variable instead of fixed at six hours? Here’s a diff with a proposed implementation:
Variable vCard Cache Interval.txt.zip (683 Bytes)

Hi Matt,

is there a good reason to make the variable public? I prefer setter methods and private variables.

LG

As a rule, I do as well. The only reason I didn’t create accessor methods in this case was to be consistent with the rest of the implementation for this class. (avatarBytes and avatarType notwithstanding)

Interesting. I wonder whether it is a good thing to extend classes like this. Sooner or later one will have a lot of public static variables which may make it impossible for other projects to use this single class due to security considerations.

How’s this?

 /**
     * The interval on which to flush the vCard cache in milliseconds
     * The cache timer is initialized with this value the first time getVCard() is called.
     * Changes to this value will not take effect until the end of the current cache interval.
     * The default value is 6 hours.
     * @see expireCache
     *
     * @return milliseconds
     *
     */
    public static function get cacheExpiration() : Number
    {
        return VCard.cacheFlushInterval;
    }
   
    public static function set cacheExpiration(value:Number) : void
    {
        VCard.cacheFlushInterval = value;
    }
   
    /**
     * Immediately expires the vCard cache.  The expiration timer starts again when getVCard is called next
     * @see getVCard
     * @see cacheExpiration
     *
     */       
    public static function expireCache() : void
    {
        if( VCard.cacheFlushTimer.running )
            VCard.cacheFlushTimer.stop();
    }

Tweaked version of your patch applied.

Along with many more vCard updates.