Perforce

com.perforce.api
Interface Cacheable

All Known Implementing Classes:
SourceControlObject

public interface Cacheable

An interface that indicates the implementing class can be cached for some period of time. Implementing classes will be stored in a HashDecay instance. Each instantiating class must create its own HashDecay instance and return a reference to it through the getCache method. The update time is what is used by the HasDecay to determine when an object will decay and be discarded.

Version:
$Date: 2002/08/05 $ $Revision: #6 $
Author:
David Markley
See Also:
HashDecay

Method Summary
 void clearCache()
          Removes any cached objects.
 void commit()
          Stores this object back into Perforce, creating it if it didn't already exist.
 HashDecay getCache()
          Returns the HashDecay instance for this class
 long getSyncTime()
          Returns the time, in milliseconds, that this object was synchronized.
 long getUpdateTime()
          Returns the time, in milliseconds, for this object's last update.
 void inSync()
          Marks this object as being in in sync or valid.
 void invalidate()
          Invalidates this object.
 boolean outOfSync(long threshold)
          Tests this object to see if it is out of sync.
 void refreshUpdateTime()
          Sets the update time for this object to the current time.
 void sync()
          Brings this object back into sync with Perforce.
 

Method Detail

clearCache

public void clearCache()
Removes any cached objects.

commit

public void commit()
            throws CommitException
Stores this object back into Perforce, creating it if it didn't already exist.

getCache

public HashDecay getCache()
Returns the HashDecay instance for this class

getSyncTime

public long getSyncTime()
Returns the time, in milliseconds, that this object was synchronized.

getUpdateTime

public long getUpdateTime()
Returns the time, in milliseconds, for this object's last update.

inSync

public void inSync()
Marks this object as being in in sync or valid.

invalidate

public void invalidate()
Invalidates this object.

outOfSync

public boolean outOfSync(long threshold)
Tests this object to see if it is out of sync. Checks to see if the expiration time is within the specified number of milliseconds.
Parameters:
threshold - Number of milliseconds.
Returns:
True if the object will be out of sync within the threshold.

refreshUpdateTime

public void refreshUpdateTime()
Sets the update time for this object to the current time.

sync

public void sync()
          throws PerforceException
Brings this object back into sync with Perforce. This also sets the sets the update and sync time for this object.

Perforce

Copyright © 2001, Perforce Software, All rights reserved.