FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Cache Class Reference

Wrapper for the Doctrine cache. More...

Inheritance diagram for Cache:
Component Thing

Public Member Functions

 createProvider ($type, $params=null)
 
 save ($id, $data, $ttl=null)
 Save data to the cache. More...
 
 fetch ($id, $ttl=null, $callback=null)
 Fetch with callback function in case cache fails. More...
 
 __call ($func_name, $params)
 See vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php for the available functions (save, contains, fetch, delete, flushAll, getStats) and more explanation. More...
 
 __invoke ($id)
 
- Public Member Functions inherited from Component
 __construct ($fred, $config=null)
 
 __destruct ()
 
 clientConfig ()
 Public configuration. More...
 
 config ($key, $default=null)
 Retrieve a config value. More...
 
 ping ()
 Ping function. More...
 
 filemtime ($filename)
 Filemtime with session cache. More...
 
 component ($name)
 Get a component (local or default). More...
 
 components (... $names)
 Get multiple components in an array. More...
 
- Public Member Functions inherited from Thing
 propertyExists ($property)
 Check if a property exists (public or published). More...
 
 constants ($prefix=null)
 Return all constants. More...
 
 get ($key)
 Get one or more properties. More...
 
 set ($key, $value=null)
 Set one or more properties. More...
 
 __get ($key)
 
 __set ($key, $value)
 

Data Fields

const TYPE_ARRAY = 'array'
 
const TYPE_CHAIN = 'chain'
 
 $busyPlaceholder = null
 Placeholder for preventing cache slam. More...
 
 $defaultTtl = null
 Default lifetime. More...
 
 $ttlVariation = null
 Variation (plus and minus; percentage) of input value. More...
 
 $statPrefix = null
 Set to something to stat all cache requests (hit/miss). More...
 
 null => null]
 
- Data Fields inherited from Component
 $filemtimeTtl = 0
 
- Data Fields inherited from Thing
const HIDDEN = 0
 Property is hidden. More...
 
const READABLE = 1
 Property is readable. More...
 
const WRITEABLE = 2
 Property is writeable. More...
 
const READWRITE = 3
 Property is readable and writeable. More...
 

Protected Member Functions

 init ()
 
 getProvider ()
 
 setRefresh ($value)
 
- Protected Member Functions inherited from Component
 init ()
 
 done ()
 
 getSession ()
 
- Protected Member Functions inherited from Thing
 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 configure ($config)
 Configure the object. More...
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). More...
 
 _set ($key, $value)
 Default setter if no specific setter is defined, and the property is also not published (writeable). More...
 

Protected Attributes

 $_type = self::TYPE_ARRAY
 Cache type to use. More...
 
 $_params = null
 Parameters (arguments) for this type of cache. More...
 
 $_altType = self::TYPE_CHAIN
 
 $_altParams = [self::TYPE_ARRAY => null
 
 $_busyTtl = null
 Lifetime for cache slam prevention (default = current timeout). More...
 
 $_provider = null
 
 $_altProvider = null
 
 $_useAlt = false
 
 $_refresh = false
 
 $_refreshed = []
 
 $_duploCount = []
 
- Protected Attributes inherited from Component
 $_fred = null
 
 $_config = null
 
 $_name = null
 
 $_components = []
 Local components (key = component name, value = component). More...
 
 $_session = null
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 

Detailed Description

Wrapper for the Doctrine cache.

Definition at line 8 of file Cache.php.

Member Function Documentation

◆ __call()

__call (   $func_name,
  $params 
)

See vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php for the available functions (save, contains, fetch, delete, flushAll, getStats) and more explanation.

Definition at line 109 of file Cache.php.

◆ __invoke()

__invoke (   $id)

Definition at line 120 of file Cache.php.

◆ createProvider()

createProvider (   $type,
  $params = null 
)

Definition at line 36 of file Cache.php.

◆ fetch()

fetch (   $id,
  $ttl = null,
  $callback = null 
)

Fetch with callback function in case cache fails.

Parameters
string$idCache id.
int$ttlCache lifetime (null = use default, 0 = never expire).
function$callbackFunction to get data if cache fails (parameters: $id; returns data).
Returns
mixed Data (false on fail).

Definition at line 68 of file Cache.php.

◆ getProvider()

getProvider ( )
protected

Definition at line 94 of file Cache.php.

◆ init()

init ( )
protected

Definition at line 31 of file Cache.php.

◆ save()

save (   $id,
  $data,
  $ttl = null 
)

Save data to the cache.

Parameters
string$idCache id.
mixed$data
int$ttlCache lifetime (null = use default, 0 = never expire).

Definition at line 52 of file Cache.php.

◆ setRefresh()

setRefresh (   $value)
protected

Definition at line 101 of file Cache.php.

Field Documentation

◆ $_altParams

$_altParams = [self::TYPE_ARRAY => null
protected

Definition at line 21 of file Cache.php.

◆ $_altProvider

$_altProvider = null
protected

Definition at line 25 of file Cache.php.

◆ $_altType

$_altType = self::TYPE_CHAIN
protected

Definition at line 20 of file Cache.php.

◆ $_busyTtl

$_busyTtl = null
protected

Lifetime for cache slam prevention (default = current timeout).

Definition at line 22 of file Cache.php.

◆ $_duploCount

$_duploCount = []
protected

Definition at line 29 of file Cache.php.

◆ $_params

$_params = null
protected

Parameters (arguments) for this type of cache.

Definition at line 19 of file Cache.php.

◆ $_provider

$_provider = null
protected

Definition at line 24 of file Cache.php.

◆ $_refresh

$_refresh = false
protected

Definition at line 27 of file Cache.php.

◆ $_refreshed

$_refreshed = []
protected

Definition at line 28 of file Cache.php.

◆ $_type

$_type = self::TYPE_ARRAY
protected

Cache type to use.

Definition at line 18 of file Cache.php.

◆ $_useAlt

$_useAlt = false
protected

Definition at line 26 of file Cache.php.

◆ $busyPlaceholder

$busyPlaceholder = null

Placeholder for preventing cache slam.

Definition at line 13 of file Cache.php.

◆ $defaultTtl

$defaultTtl = null

Default lifetime.

Definition at line 14 of file Cache.php.

◆ $statPrefix

$statPrefix = null

Set to something to stat all cache requests (hit/miss).

Definition at line 16 of file Cache.php.

◆ $ttlVariation

$ttlVariation = null

Variation (plus and minus; percentage) of input value.

Definition at line 15 of file Cache.php.

◆ null

null => null]

Definition at line 21 of file Cache.php.

◆ TYPE_ARRAY

const TYPE_ARRAY = 'array'

Definition at line 10 of file Cache.php.

◆ TYPE_CHAIN

const TYPE_CHAIN = 'chain'

Definition at line 11 of file Cache.php.


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