PHP Class Horde_ActiveSync_SyncCache, horde

Author: Michael J Rubinsky ([email protected])
显示文件 Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_data array The cache data.
$_devid string The device id
$_dirty array Track dirty properties.
$_logger Horde_Log_Logger Logger
$_procid integer Process id for logging.
$_state Horde_ActiveSync_State_Base The state driver
$_user string The username

Public Methods

Method Description
__construct ( Horde_ActiveSync_State_Base $state, string $devid, string $user, Horde_Log_Logger $logger = null ) : Horde_ActiveSync_SyncCache Constructor
__get ( $property )
__isset ( $property )
__set ( $property, $value )
addCollection ( array $collection ) Add a new collection to the cache
addConfirmedKey ( string $key ) Add a confirmed synckey to the cache.
clearCollectionKeys ( ) Clear all synckeys from the known collections.
clearCollections ( ) Remove all collection data.
clearFolders ( ) Clear the folder cache
collectionExists ( stirng $collectionid ) : boolean Check for the existance of a specific collection in the cache.
collectionIsPingable ( string $id ) : boolean Check if a specified collection is PINGable.
countCollections ( ) Return the count of available collections in the cache
delete ( ) Delete the entire synccache from the backend.
deleteFolder ( string $folder ) Remove a folder from the cache
getCollections ( boolean $requireKey = true ) : array Return all the collections in the syncCache.
getFolder ( string $folder ) : array | boolean Return an entry from the folder cache.
getFolders ( ) Return the folders cache.
hasPingChangeFlag ( string $collectionid ) : boolean Checks the status of the ping change flag. If true, the last PING request detected a change in the specified collection.
loadCacheFromStorage ( ) Repopulate the cache data from storage.
refreshCollections ( ) Refresh the cached collections from the state backend.
refreshFolderCache ( ) Refresh the folder cache from the backend.
removeCollection ( string $id, boolean $purge = true ) Remove a collection from the cache.
removeConfirmedKey ( string $key ) Remove a confirmed sycnkey from the cache
removePingableCollection ( $id ) Set a collection as non-PINGable.
resetPingChangeFlag ( string $id ) Reset the specified collection's ping change flag.
save ( ) Save the synccache to storage.
setPingChangeFlag ( string $id ) Set the ping change flag on a collection. Indicatates that the last PING was terminated with a change in this collection.
setPingableCollection ( string $id ) Set a specific collection to be PINGable.
updateCollection ( array $collection, array $options = [] ) Update a collection in the cache.
updateFiltertype ( string $id, integer $filtertype ) Update the filtertype for the specified collection.
updateFolder ( Horde_ActiveSync_Message_Folder $folder ) Update a folder entry in the cache.
updateTimestamp ( ) Update the cache timestamp to the current time.
updateWindowSize ( string $id, $windowsize ) Update the windowsize for the specified collection.
validateCache ( boolean $hb_only = false ) : boolean Validate the cache. Compares the cache timestamp with the current cache timestamp in the state backend. If the timestamps are different, some other request has modified the cache, so it should be invalidated.
validateCollectionsFromCache ( array &$collections ) Validate the collections from the cache and fill in any missing values from the folder cache.
validateTimestamps ( ) : boolean Perform some sanity checking on the various timestamps to ensure we are in a valid state. Basically checks that we are not currently running a looping sync and that the last looping sync ending normally.

Protected Methods

Method Description
_isValidProperty ( $property )
_markCollectionsDirty ( boolean $id ) Mark specific collection as dirty, but only if the entire collection data is not already marked dirty.

Method Details

__construct() public method

Constructor
public __construct ( Horde_ActiveSync_State_Base $state, string $devid, string $user, Horde_Log_Logger $logger = null ) : Horde_ActiveSync_SyncCache
$state Horde_ActiveSync_State_Base The state driver
$devid string The device id
$user string The username
$logger Horde_Log_Logger The logger object
return Horde_ActiveSync_SyncCache

__get() public method

public __get ( $property )

__isset() public method

public __isset ( $property )

__set() public method

public __set ( $property, $value )

_isValidProperty() protected method

protected _isValidProperty ( $property )

_markCollectionsDirty() protected method

Mark specific collection as dirty, but only if the entire collection data is not already marked dirty.
protected _markCollectionsDirty ( boolean $id )
$id boolean The collection to mark dirty.

addCollection() public method

Add a new collection to the cache
public addCollection ( array $collection )
$collection array The collection array

addConfirmedKey() public method

Add a confirmed synckey to the cache.
public addConfirmedKey ( string $key )
$key string The synckey to add.

clearCollectionKeys() public method

Clear all synckeys from the known collections.
public clearCollectionKeys ( )

clearCollections() public method

Remove all collection data.
public clearCollections ( )

clearFolders() public method

Clear the folder cache
public clearFolders ( )

collectionExists() public method

Check for the existance of a specific collection in the cache.
public collectionExists ( stirng $collectionid ) : boolean
$collectionid stirng The collection id to search for.
return boolean

collectionIsPingable() public method

Check if a specified collection is PINGable.
public collectionIsPingable ( string $id ) : boolean
$id string The collection id.
return boolean

countCollections() public method

Return the count of available collections in the cache
public countCollections ( )

delete() public method

Delete the entire synccache from the backend.
public delete ( )

deleteFolder() public method

Remove a folder from the cache
public deleteFolder ( string $folder )
$folder string The folder id to remove.

getCollections() public method

Return all the collections in the syncCache.
public getCollections ( boolean $requireKey = true ) : array
$requireKey boolean If true, only return collections with an existing synckey in the cache. Otherwise return all collections.
return array

getFolder() public method

Return an entry from the folder cache.
public getFolder ( string $folder ) : array | boolean
$folder string The folder id to return.
return array | boolean The folder cache array entry, false if not found.

getFolders() public method

Return the folders cache.
public getFolders ( )

hasPingChangeFlag() public method

Checks the status of the ping change flag. If true, the last PING request detected a change in the specified collection.
Since: 2.3.0
public hasPingChangeFlag ( string $collectionid ) : boolean
$collectionid string The collection id to check.
return boolean

loadCacheFromStorage() public method

Repopulate the cache data from storage.

refreshCollections() public method

Refresh the cached collections from the state backend.
public refreshCollections ( )

refreshFolderCache() public method

Refresh the folder cache from the backend.
Since: 2.18.0
public refreshFolderCache ( )

removeCollection() public method

Remove a collection from the cache.
public removeCollection ( string $id, boolean $purge = true )
$id string The collection id.
$purge boolean If true, completely remove the collection entry otherwise, just resets the synckey.

removeConfirmedKey() public method

Remove a confirmed sycnkey from the cache
public removeConfirmedKey ( string $key )
$key string The synckey to remove.

removePingableCollection() public method

Set a collection as non-PINGable.
public removePingableCollection ( $id )

resetPingChangeFlag() public method

Reset the specified collection's ping change flag.
Since: 2.3.0
public resetPingChangeFlag ( string $id )
$id string The collectionid to reset.

save() public method

Save the synccache to storage.
public save ( )

setPingChangeFlag() public method

Set the ping change flag on a collection. Indicatates that the last PING was terminated with a change in this collection.
Since: 2.3.0
public setPingChangeFlag ( string $id )
$id string The collection id.

setPingableCollection() public method

Set a specific collection to be PINGable.
public setPingableCollection ( string $id )
$id string The collection id.

updateCollection() public method

Update a collection in the cache.
public updateCollection ( array $collection, array $options = [] )
$collection array The collection data to add/update.
$options array Options: - newsynckey: (boolean) Set the new synckey in the collection. DEFAULT: false (Do not set the new synckey). - unsetChanges: (boolean) Unset the GETCHANGES flag in the collection. DEFAULT: false (Do not unset the GETCHANGES flag). - unsetPingChangeFlag: (boolean) Unset the PINGCHANGES flag in the collection. DEFUALT: false (Do not uset the PINGCHANGES flag). @since 2.3.0

updateFiltertype() public method

Update the filtertype for the specified collection.
Since: 2.26.0
public updateFiltertype ( string $id, integer $filtertype )
$id string The collection id.
$filtertype integer The updated filtertype.

updateFolder() public method

Update a folder entry in the cache.
public updateFolder ( Horde_ActiveSync_Message_Folder $folder )
$folder Horde_ActiveSync_Message_Folder The folder object.

updateTimestamp() public method

Update the cache timestamp to the current time.
public updateTimestamp ( )

updateWindowSize() public method

Update the windowsize for the specified collection.
public updateWindowSize ( string $id, $windowsize )
$id string The collection id.

validateCache() public method

Validate the cache. Compares the cache timestamp with the current cache timestamp in the state backend. If the timestamps are different, some other request has modified the cache, so it should be invalidated.
public validateCache ( boolean $hb_only = false ) : boolean
$hb_only boolean If true, only validate the hb timestamps. @since 2.4.0
return boolean

validateCollectionsFromCache() public method

Validate the collections from the cache and fill in any missing values from the folder cache.
public validateCollectionsFromCache ( array &$collections )
$collections array A reference to an array of collections.

validateTimestamps() public method

Perform some sanity checking on the various timestamps to ensure we are in a valid state. Basically checks that we are not currently running a looping sync and that the last looping sync ending normally.
Deprecation: Not needed any longer. Remove in H6.
public validateTimestamps ( ) : boolean
return boolean

Property Details

$_data protected_oe property

The cache data.
protected array $_data
return array

$_devid protected_oe property

The device id
protected string $_devid
return string

$_dirty protected_oe property

Track dirty properties.
protected array $_dirty
return array

$_logger protected_oe property

Logger
protected Horde_Log_Logger $_logger
return Horde_Log_Logger

$_procid protected_oe property

Process id for logging.
protected int $_procid
return integer

$_state protected_oe property

The state driver
protected Horde_ActiveSync_State_Base $_state
return Horde_ActiveSync_State_Base

$_user protected_oe property

The username
protected string $_user
return string