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

Public Member Functions

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

Protected Member Functions

 beforeInit ()
 
 afterInit ()
 

Protected Attributes

 $cfg
 

Detailed Description

Interface for cache classes

Definition at line 10 of file cache/abstract.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())
abstract

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

Parameters
array$prmParameter for the cached variable to deleted:
  • string class: ClassName which created the cache (optionnal)
  • string function: function which created the cache (optionnal)
  • 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

◆ end()

end ( )
abstract

Save the output with the setting passed by the last call from start

Returns
string The content cached
See also
start

◆ exists()

exists ( array  $prm)
abstract

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

◆ get()

get ( $value,
array  $prm 
)
abstract

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 elements :

  • 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
  • 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
Returns
false|int Cache date if found and content in $value or false
See also
save

◆ 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 ( )

Check if the cache is enabled

Returns
bool

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

◆ save()

save ( )
abstract

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

Returns
bool True if success
See also
get

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

Set the default config

Parameters
array$cfg

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

◆ start()

start ( array  $prm)
abstract

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 elements :

  • 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
  • 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

Field Documentation

◆ $cfg

$cfg
protectedinherited

Definition at line 17 of file object.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