[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Cache/ -> Cache.php (summary)

(no description)

File Size: 237 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Cache:: (12 methods):
  __construct()
  getTime()
  getEvent()
  setEvent()
  useCache()
  makeDefaultCacheDecision()
  addDependencies()
  retrieveCache()
  storeCache()
  removeCache()
  stats()
  isNoCache()


Class: Cache  - X-Ref

Generic handling of caching

__construct($key, $ext)   X-Ref

param: string $key primary identifier
param: string $ext file extension

getTime()   X-Ref


getEvent()   X-Ref
No description

setEvent($event)   X-Ref
No description

useCache($depends = array()   X-Ref
public method to determine whether the cache can be used

to assist in centralisation of event triggering and calculation of cache statistics,
don't override this function override makeDefaultCacheDecision()

param: array $depends array of cache dependencies, support dependecies:
return: bool    true if cache can be used, false otherwise

makeDefaultCacheDecision()   X-Ref
internal method containing cache use decision logic

this function processes the following keys in the depends array
purge - force a purge on any non empty value
age   - expire cache if older than age (seconds)
files - expire cache if any file in this array was updated more recently than the cache

Note that this function needs to be public as it is used as callback for the event handler

can be overridden

return: bool               see useCache()

addDependencies()   X-Ref
add dependencies to the depends array

this method should only add dependencies,
it should not remove any existing dependencies and
it should only overwrite a dependency when the new value is more stringent than the old

retrieveCache($clean = true)   X-Ref
retrieve the cached data

param: bool $clean true to clean line endings, false to leave line endings alone
return: string          cache contents

storeCache($data)   X-Ref
cache $data

param: string $data the data to be cached
return: bool           true on success, false otherwise

removeCache()   X-Ref
remove any cached data associated with this cache instance


stats($success)   X-Ref
Record cache hits statistics.
(Only when debugging allowed, to reduce overhead.)

param: bool $success result of this cache use attempt
return: bool              pass-thru $success value

isNoCache()   X-Ref

return: bool