Show:

Q_Cache Class

Module: Q

Used to maintain arbitrary data in persistent cache storage

Item Index

Methods

Methods

clear

(
  • $key
  • [$prefix=false]
  • [$namespace=self::$namespace]
)
Boolean static

Clear Q_Cache entry

Parameters:

  • $key String | True

    The key of cache entry. Skip this to clear all the keys. Pass true to also clear the user files cache.

  • [$prefix=false] Boolean optional

    Whether to clear all keys for which $key is a prefix

  • [$namespace=self::$namespace] String optional

    The namespace to use

Returns:

Boolean:

Whether an apc cache was fetched.

connected

() Boolean static

Check if Q_Cache is connected to some PHP cache engine (currently APC)

Returns:

Boolean:

Whether cache is currently connected

exists

(
  • $key
  • [$namespace=self::$namespace]
)
Boolean static

Check if a Q_Cache entry exists

Parameters:

  • $key String

    The key of cache entry

  • [$namespace=self::$namespace] String optional

    The namespace to use

Returns:

Boolean:

Whether it exists

fetchStore

(
  • [$namespace=self::$namespace]
  • [$fetched]
)
Array protected static

Fetches the cache store from APC. In either case, prepares self::$store[$namespace] to be used as an array.

Parameters:

  • [$namespace=self::$namespace] String optional

    The namespace to use

  • [$fetched] Boolean optional

    If passed, this is filled with whether the store was fetched

Returns:

Array:

A reference to the cache store, or to an empty array if nothing was fetched

get

(
  • $key
  • [$default=null]
  • [$namespace=self::$namespace]
)
Mixed static

Get Q_Cache entry

Parameters:

  • $key String

    The key of cache entry

  • [$default=null] Mixed optional

    In case the entry isn't there

  • [$namespace=self::$namespace] String optional

    The namespace to use

Returns:

Mixed:

The value of Q_Cache entry, or null on failure

ignore

(
  • $setting
)
Boolean static

Can be used to ignore the cache for a while, to re-populate it

Parameters:

  • $setting Boolean

    Whether to start or to stop ignoring the cache during Q_Cache::get

Returns:

Boolean:

Returns the old setting

init

() static

set

(
  • $key
  • $value
  • [$namespace=self::$namespace]
)
Boolean static

Set Q_Cache entry

Parameters:

  • $key String

    The key of cache entry

  • $value Mixed

    The value to set in cache

  • [$namespace=self::$namespace] String optional

    The namespace to use

Returns:

Boolean:

Whether cache was fetched (if not, it will attempt to be saved at script shutdown)

setDuration

(
  • $duration
  • [$namespace=self::$namespace]
)
protected static

Set the duration for a given cache store. The default is in Q/cache/duration config.

Parameters:

  • $duration Integer

    The number of seconds to store until the cache under this namespace expires

  • [$namespace=self::$namespace] String optional

    The namespace to use

shutdownFunction

() static

Properties

$apc

Boolean protected

$apcu

Boolean protected

$changed

Array protected

$durations

Array protected

$ignore

Boolean protected

$namespace

String protected

$store

Array protected