nyroFwk  0.2
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
cache_file Class Reference
Inheritance diagram for cache_file:
cache_abstract object

Public Member Functions

 get (&$value, array $prm)
 
 save ()
 
 start (array $prm)
 
 end ()
 
 delete (array $prm=array())
 
 exists (array $prm)
 
 setCfg (array $cfg)
 
 isEnabled ()
 
 getAttr ($name)
 
 setAttr ($name, $value)
 
 getCfg ()
 

Protected Member Functions

 beforeInit ()
 
 afterInit ()
 

Protected Attributes

 $prmVar
 
 $prmOut
 
 $cfg
 

Private Member Functions

 file (array $prm)
 

Private Attributes

 $obSave
 

Detailed Description

Cache using files

Definition at line 10 of file cache/file.class.php.

Member Function Documentation

◆ afterInit()

afterInit ( )
protectedinherited

Call just after the configuration initialisation

Definition at line 40 of file object.class.php.

◆ beforeInit()

beforeInit ( )
protectedinherited

Call just before the configuration initialisation

Definition at line 35 of file object.class.php.

◆ delete()

delete ( array  $prm = array())

Delete cached value. You cand define what you want. If you define nothing, all the cache will be deleted.

Parameters
array$prmParameter for the cached variable to deleted:
  • string callFrom: Representing CLASS-FUNCTION name of the original calling cache
  • string type: Cache type, could be 'get' or 'start' (optionnal)
  • string id: Cache id (optionnal)
  • array tags: Tags for the id (optionnal)
Returns
int|bool Number of cache deleted or false
See also
get, start

Definition at line 181 of file cache/file.class.php.

◆ end()

end ( )

Save the output with the setting passed by the last call from start, and show it

Returns
bool True if store cache success
See also
start

Definition at line 152 of file cache/file.class.php.

◆ exists()

exists ( array  $prm)

Indicate if a cache exists

Parameters
array$prmParameter for the cached variable:
  • string type: Cache type, must be 'get' or 'start' (required)
  • string id: Cache id (required)
  • array tags: Optionnal tags for the id
  • array request: Array for build the request ID (
See also
cache::idRequest)
  • bool serialize: True if need to serialize the content (default: true)
Returns
bool True if it exists
See also
get, start

Definition at line 218 of file cache/file.class.php.

◆ file()

file ( array  $prm)
private

Return the cache file path The cache id is made with 5 kinds :

  • the $id passed to the function
  • the get, post, session or cookie variable if set
  • the class and function name where the cache is call
  • the tags if set
  • 'cache' or 'get' is added (to differenciate output and variable caching)
Parameters
array$prmParameter for the cached file:
  • string callFrom: where the cached isrequested (format: className-Function) (required)
  • string type: Cache type, must be 'get' or 'start' (required)
  • string id: Cache id (required)
  • array tags: Optionnal tags for the id
  • array request: Array for build the request ID (
See also
cache::idRequest)
Returns
string The cache file path

Definition at line 240 of file cache/file.class.php.

◆ get()

get ( $value,
array  $prm 
)

Try to get a variable cached. If not found, information will be stored and used with the next call from save. The cache id is made with 5 kinds :

  • the $id passed to the function
  • the get, post, session or cookie variable if set
  • the class and function name where the cache is call
  • the tags if set
  • 'get' is added (to differenciate from output caching)
Parameters
mixed$valuethe variable where the content must be placed
array$prmParameter for the cached variable:
  • int ttl: Time to live, in minutes, 0 for eternal (default: 60)
  • string id: Cache id (required)
  • array tags: Optionnal tags for the id
  • array request: Array for build the request ID (
See also
cache::idRequest)
  • bool serialize: True if need to serialize the content (default: true)
Returns
false|int Cache date if found and content in $value or false
See also
save

Definition at line 53 of file cache/file.class.php.

◆ getAttr()

getAttr (   $name)
inherited

Get an attribute

Parameters
string$nameAttribute name
Returns
mixed|null The attribute or null if not set

Definition at line 48 of file object.class.php.

◆ getCfg()

getCfg ( )
inherited

Get the configuration object

Returns
config

Definition at line 67 of file object.class.php.

◆ isEnabled()

isEnabled ( )
inherited

Check if the cache is enabled

Returns
bool

Definition at line 26 of file cache/abstract.class.php.

◆ save()

save ( )

Save a variable with the setting passed by the last call from get

Parameters
mixed$valueThe variable to cache
Returns
bool True if success
See also
get

Definition at line 87 of file cache/file.class.php.

◆ setAttr()

setAttr (   $name,
  $value 
)
inherited

Set an attribute

Parameters
string$nameAttribute name
mixed$valueAttribute value

Definition at line 58 of file object.class.php.

◆ setCfg()

setCfg ( array  $cfg)
inherited

Set the default config

Parameters
array$cfg

Definition at line 17 of file cache/abstract.class.php.

◆ start()

start ( array  $prm)

Try to get an output cached. If not found, information will be stored and used with the next call from end. The cache id is made with 5 kinds :

  • the $id passed to the function
  • the get, post, session or cookie variable if set
  • the class and function name where the cache is call
  • the tags if set
  • 'cache' is added (to differenciate from variable caching)
Parameters
array$prmParameter for the cached variable:
  • int ttl: Time to live, in minutes, 0 for eternal (default: 60)
  • string id: Cache id (required)
  • array tags: Optionnal tags for the id
  • array request: Array for build the request ID (
See also
cache::idRequest)
Returns
bool True if cache found and content printed
See also
end

Definition at line 116 of file cache/file.class.php.

Field Documentation

◆ $cfg

$cfg
protectedinherited

Definition at line 17 of file object.class.php.

◆ $obSave

$obSave
private

Definition at line 31 of file cache/file.class.php.

◆ $prmOut

$prmOut
protected

Definition at line 24 of file cache/file.class.php.

◆ $prmVar

$prmVar
protected

Definition at line 17 of file cache/file.class.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 15 2017 22:25:20 for nyroFwk by doxygen 1.8.13