Exists

Navigation:  Development > Function Reference > Module > Cache >

Exists

Previous pageReturn to chapter overviewNext page

Check existence of a cache name.
 

App::Module('Cache')->Exists(Name);
 

 

Parameter

Type

Description

Name

Mandatory

Name of the cache entry

 

See bellow examples:

 

// Create a cache if not exists
if(!App::Module('Cache')->Exists('mycache')){
  App::Module('Cache')->Write('mycache','Hello World');
}
 
// Remove a cache if exists 
if(App::Module('Cache')->Exists('mycache')){
  App::Module('Cache')->Delete('mycache');
}