Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Cache_Storage_Memcache Class Reference
Inheritance diagram for Cache_Storage_Memcache:
Cache_Storage Asset MySource_Object

Public Member Functions

 __construct ($assetid=0)
 
 initMemcache ()
 
 store ($cache_key, $perm_key, $url, $assetid, $data, $expiry)
 
 read ($cache_key, $perm_key, $url, $assetid)
 
 clearAll ()
 
 cleanExpiredEntries ()
 
 canClearByAssetid ()
 
 clear ($assetids)
 
 clearCachedAssetsByUrl ($url)
 
 getFilePaths ($assetids)
 
 getAllFilePaths ($option='')
 
 failureCallback ($hostname, $port)
 
- Public Member Functions inherited from Cache_Storage
 __construct ($assetid=0)
 
 store ($cache_key, $perm_key, $url, $assetid, $data, $expiry)
 
 read ($cache_key, $perm_key, $url, $assetid)
 
 clearAll ()
 
 canClearByAssetid ()
 
 clear ($assetids)
 
 cleanExpiredEntries ()
 
 getFilePaths ($assetids)
 
 getAllFilePaths ($option='')
 
 clearCachedAssetsByUrl ($url)
 
- Public Member Functions inherited from Asset
 Asset ($assetid=0)
 
 create (Array &$link)
 
 load ($assetid)
 
 _loadDataPaths ()
 
 reload ()
 
 canDelete ()
 
 delete ($release_lock=TRUE, $check_locked=TRUE)
 
 useSystemVersion ()
 
 loadSystemVersion ()
 
 saveSystemVersion ()
 
 clearSystemVersion ()
 
 revertToSystemVersion ()
 
 revertNoticeLinksToSystemVersion ()
 
 _updated ($update_parents=TRUE)
 
 type ()
 
 getTypeAncestors ($include_asset=TRUE)
 
 incrementVersion ($number='micro', $update_parents=TRUE)
 
 getLanguages ()
 
 setLanguages (Array $languages)
 
 setCharset ($charset)
 
 setForceSecure ($force_secure)
 
 remapAssetids (Array $map)
 
 morph ($new_type_code)
 
 _morphCleanup ($new_type_code)
 
 onRequestKeywords (Asset $broadcaster, Array $vars=Array())
 
 canClone ()
 
 cloneComponents (Asset $clone, Array $components, $override=FALSE)
 
 cloneComponentsAdditional (Asset $clone, Array $components)
 
 cloneLinks (Asset $clone)
 
 getStatus ()
 
 getAvailableStatii ()
 
 getStatusDescription ()
 
 processStatusChange ($new_status, $update_parents=TRUE, $run_updated=TRUE)
 
 setDate ($date_type, $time=NULL, $userid=NULL)
 
 lockTypes ()
 
 canForceablyAcquireLock ($lock_type)
 
 getEditingLocks ($keywords)
 
 _getAllowedLinks ()
 
 createLink (Asset $minor, $link_type, $value='', $sort_order=NULL, $dependant='0', $exclusive='0', $moving=FALSE, $locked=0)
 
 prepareLink (Asset $asset, $side_of_link, &$link_type, &$value, &$sort_order, &$dependant, &$exclusive)
 
 canCreateLink (Asset $minor, $link_type, $exclusive)
 
 canMoveLink (Asset $minor, Asset $old_major, $link_type)
 
 describeLink ($linkid)
 
 isDeletableLink ($linkid)
 
 canDeleteLink ($linkid)
 
 deleteLink ($linkid, $check_locked=TRUE)
 
 linksUpdated ()
 
 canCloneLink ()
 
 saveAttributes ($dont_run_updated=FALSE, $log_message=TRUE)
 
 setAttrValue ($name, $value)
 
 attr ($name)
 
attrByRef ($name)
 
 getAttribute ($name, $mute_errors=FALSE)
 
 getAssetKeywords ($descriptions=FALSE)
 
 getAvailableKeywords ()
 
 getKeywordReplacement ($keyword)
 
 getAssetWebPathKeywordReplacement ()
 
 getCustomKeywordReplacements ($keywords=Array(), $invoke_backend=FALSE)
 
 processCustomKeywords ($keywords=Array())
 
 getContent ()
 
 setContent ()
 
 getEffectiveLastUpdatedTime ($assetids)
 
 readAccess (Array $assetids=Array())
 
 writeAccess ($lock_type='', Array $assetids=Array(), $only_workflow=TRUE)
 
 adminAccess ($lock_type='', Array $assetids=Array())
 
 backendAccess ()
 
 liveEditAccess ($lock_type)
 
 canliveEdit ($lock_type)
 
 effectiveUnrestricted ()
 
 checkAccess ($perm, $lock_type, Array $assetids=Array(), $only_workflow=TRUE)
 
 accessEffective ()
 
 permissionsUpdated ()
 
 printFrontend ()
 
 printFrontendAsset (Asset $asset, $design=NULL)
 
 getValidProtocols ()
 
 printHead ()
 
 printBody ()
 
 getCurrentPaintLayoutName ()
 
 getCurrentDesignName ()
 
 printBodyWithPaintLayout ($layout_id='')
 
 initLimbo ()
 
 printLimbo ()
 
 paintBackend (Backend_Outputter $o)
 
 getPrefix ()
 
 processBackend (Backend_Outputter $o, Array &$link)
 
 getEI ()
 
 getEditFns ()
 
 getBackendHref ($screen='', $backend_page=TRUE)
 
 getURL ($base_url=NULL, $ignore_rollback=FALSE, $base_contextid=NULL)
 
 getURLs ()
 
 getHref ($base_url=NULL, $ignore_rollback=FALSE)
 
 getWebDataPath ()
 
 getWebPaths ()
 
 saveWebPaths ($paths, $auto_add_remaps=TRUE)
 
 getLookups ($field='')
 
 getDesignLookups ()
 
 getLookupValues ($inherited=NULL, $prefix='', $like_search=TRUE, $ignore_override=FALSE)
 
 deleteLookupValue ($layout_name, $layout_value)
 
 setPaintLayouts ($layouts)
 
 updateLookups ($auto_add_remaps=TRUE)
 
 setLookupValues (Array $values)
 
 getAssetStatusDescriptionKeywordReplacement ()
 
 getAssetStatusColourKeywordReplacement ()
 
 replaceKeywordsInString ($string)
 
 fastTrack ($tasks)
 
 unFastTrack ($tasks)
 
 shouldFastTrack ($task, $assetid=NULL)
 
 getFaskTrackedTaskAssetids ($task)
 
 getDependantParentsURL ()
 
- Public Member Functions inherited from MySource_Object
 MySource_Object ()
 
 __sleep ()
 
 __wakeup ()
 

Static Public Member Functions

static isAvailable ()
 
- Static Public Member Functions inherited from Cache_Storage
static isAvailable ()
 

Additional Inherited Members

- Data Fields inherited from Asset
 $id = 0
 
 $version = ''
 
 $name = ''
 
 $short_name = ''
 
 $status
 
 $languages = ''
 
 $charset = ''
 
 $force_secure = '0'
 
 $created
 
 $created_userid
 
 $updated
 
 $updated_userid
 
 $published
 
 $published_userid
 
 $status_changed
 
 $status_changed_userid
 
 $_is_cacheable = FALSE
 
 $vars = Array()
 
 $_available_keywords = Array()
 
 $data_path_suffix = ''
 
 $data_path = ''
 
 $data_path_public = ''
 
 $_ser_attrs = FALSE
 
- Protected Member Functions inherited from Asset
 _preCreateCheck (Array &$link)
 
 _createAdditional (Array &$link)
 
 _abortCreate ($trigger_level_changed=FALSE, $linkid=0)
 
 _loadVars ()
 
 _getName ($short_name=FALSE, $contextid=NULL)
 
 _getKeywordReplacement ($keyword)
 
 _checkPermissionAccess ($perm, $assetids=Array(), $only_workflow=TRUE)
 
 makeAndSaveInitialWebPath ($path, $parent_link=NULL)
 

Detailed Description

Definition at line 45 of file cache_storage_memcache.inc.

Constructor & Destructor Documentation

__construct (   $assetid = 0)

Constructor

Parameters
string$assetidthe asset id to be loaded

Definition at line 61 of file cache_storage_memcache.inc.

Member Function Documentation

canClearByAssetid ( )

Returns true if this storage method can clear cache for specific assetids.

Returns
bool public

Definition at line 266 of file cache_storage_memcache.inc.

cleanExpiredEntries ( )

Cleans up expired entries.

Assumed that memcache does this for us, so nothing to be done here.

Returns
void public

Definition at line 253 of file cache_storage_memcache.inc.

clear (   $assetids)

Removes all cache entries related to this assetid

Parameters
array$assetidsid of the the asset that owns the cache file
Returns
void public

Definition at line 281 of file cache_storage_memcache.inc.

clearAll ( )

Removes all cache

Returns
void public

Definition at line 232 of file cache_storage_memcache.inc.

clearCachedAssetsByUrl (   $url)

Deletes caches of assets that were cached when a certain URL was requested

This includes caches of nested content that were generated by reaching the passed URL, not just the top-level asset.

Parameters
string$urlThe url to delete cache entries for

public

Definition at line 310 of file cache_storage_memcache.inc.

failureCallback (   $hostname,
  $port 
)

Failure Callback function for Memcache::addServer

Parameters
$hostname
$port
Returns
void public

Definition at line 373 of file cache_storage_memcache.inc.

getAllFilePaths (   $option = '')

Returns an array of all file paths for clear cache HIPO job

Not used by this storage method, since filesystem is unused. Always returns an empty array.

Parameters
string$optionthe option of the result
Returns
array public

Definition at line 357 of file cache_storage_memcache.inc.

getFilePaths (   $assetids)

Returns an array of file paths for certain assetids, for clear cache HIPO job

Not used by this storage method, since filesystem is unused. Always returns an empty array.

Parameters
array$assetidsid of the the asset that owns the cache file
Returns
array public

Definition at line 339 of file cache_storage_memcache.inc.

static isAvailable ( )
static

Is this cache storage mechanism available?

Memcache storage only available when Memcache extension is available.

Returns
boolean

Definition at line 102 of file cache_storage_memcache.inc.

read (   $cache_key,
  $perm_key,
  $url,
  $assetid 
)

Loads the contents from a cache file for the specified asset and unique key

The URL is MD5'd before being used as part of the cache key for Memcache. Memcache keys have a limit of 250 characters before being truncated; if cache and perm keys are both set, the URL has a useful length of about 170 characters before truncating the key (and potentially the asset ID) off it - less in the case of a shadow asset.

returns FALSE if no cache version exist

Parameters
string$cache_keythe cache key for this entry
string$perm_keythe permissions key for this entry
string$urlthe url for this entry
integer$assetidthe asset id for this entry
Returns
string public

Definition at line 212 of file cache_storage_memcache.inc.

store (   $cache_key,
  $perm_key,
  $url,
  $assetid,
  $data,
  $expiry 
)

Saves the specified contents to the cache, which will be identified by the specfied asset and key/url

If cache entry already exists, it will be overwritten with the new contents and expiry time

The URL is MD5'd before being used as part of the cache key for Memcache. Memcache keys have a limit of 250 characters before being truncated; if cache and perm keys are both set, the URL has a useful length of about 170 characters before truncating the key (and potentially the asset ID) off it - less in the case of a shadow asset.

Expiry is sent to Memcache itself as an offset in seconds. Sending a timestamp adds a risk because the timestamp has to be in the local time of the Memcache server. If the server is on a dedicated hardware/VM and its date is out of sync with the server hosting Matrix, the cache period will be affected (in either direction).

Indexes are maintained, for listing cache keys associated with a URL or with an assetid. This is so that we can delete cache entries for a given URL or assetid.

Parameters
string$cache_keythe cache key for this entry
string$perm_keythe permissions key for this entry
string$urlthe url for this entry
integer$assetidthe asset id for this entry
string$datathe cache contents
integer$expirythe expiry time (UTC)
Returns
boolean public

Definition at line 149 of file cache_storage_memcache.inc.


The documentation for this class was generated from the following file: