Hoa central
Public Member Functions | Protected Attributes | List of all members
Hoa\Cache\Frontend\AFunction Class Reference
Inheritance diagram for Hoa\Cache\Frontend\AFunction:

Public Member Functions

 __call ($function, Array $arguments)
 
- Public Member Functions inherited from Hoa\Cache\Frontend\Frontend
 __construct (Cache\Backend $backend)
 
 cleanCache ($lifetime=Cache::CLEAN_EXPIRED)
 
 getBackend ()
 
- Public Member Functions inherited from Hoa\Cache\Cache
 __construct (Array $parameters=[])
 
 getParameters ()
 
 ksort (Array &$array)
 

Protected Attributes

 $_arguments = []
 
- Protected Attributes inherited from Hoa\Cache\Frontend\Frontend
 $_backend = null
 

Additional Inherited Members

- Public Attributes inherited from Hoa\Cache\Cache
const CLEAN_ALL = -1
 
const CLEAN_EXPIRED = 0
 
const CLEAN_USER = 1
 
- Protected Member Functions inherited from Hoa\Cache\Cache
 makeId ($id=null)
 
 setId ($id)
 
 getId ()
 
 getIdMd5 ()
 
 removeId ()
 
- Static Protected Attributes inherited from Hoa\Cache\Cache
static $_id = []
 

Detailed Description

Class .

Function catching system for frontend cache.

Definition at line 49 of file AFunction.php.

Member Function Documentation

Hoa\Cache\Frontend\AFunction::__call (   $function,
Array  $arguments 
)

Overload member class with __call.

Parameters
string$functionFunction called.
array$argumentsArguments of method.
Returns
mixed
Exceptions

Definition at line 68 of file AFunction.php.

69  {
70  if (!function_exists($function)) {
71  throw new Cache\Exception(
72  'Function %s does not exists.',
73  0,
74  $function
75  );
76  }
77 
78  $this->_arguments = $this->ksort($arguments);
79  $idExtra = serialize($this->_arguments);
80  $this->makeId($function . '/' . $idExtra);
81  $content = $this->_backend->load();
82 
83  if (false !== $content) {
84  echo $content[0]; // output
85 
86  return $content[1]; // return
87  }
88 
89  ob_start();
90  ob_implicit_flush(false);
91  $return = call_user_func_array($function, $arguments);
92  $output = ob_get_contents();
93  ob_end_clean();
94 
95  $this->_backend->store([$output, $return]);
96  $this->removeId();
97 
98  echo $output;
99 
100  return $return;
101  }
ksort(Array &$array)
Definition: Cache.php:258
$content
Definition: Hoa.php:119
makeId($id=null)
Definition: Cache.php:162

Here is the call graph for this function:

Member Data Documentation

Hoa\Cache\Frontend\AFunction::$_arguments = []
protected

Definition at line 56 of file AFunction.php.


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