[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

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

(no description)

File Size: 240 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 = [])   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()

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

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

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

storeCache($data)   X-Ref
cache $data

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

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.)

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

isNoCache()   X-Ref

return: bool