PHP Class Gc\Mvc\Service\CacheService

Inheritance: implements Zend\EventManager\EventManagerAwareInterface
Show file Open project: gotcms/gotcms

Protected Properties

Property Type Description
$eventManager Zend\EventManager\EventManagerInterface Static event manager

Public Methods

Method Description
__construct ( Zend\Cache\Storage\StorageInterface $cacheStorage ) Constructor
getEventManager ( ) : Zend\EventManager\EventManagerInterface Retrieve the event manager
load ( MvcEvent $e ) : mixed Check if a page is saved in the cache and return contents.
save ( MvcEvent $e ) : void Save the page contents to the cache storage.
setEventManager ( Zend\EventManager\EventManagerInterface $eventManager ) : self Inject an EventManager instance

Protected Methods

Method Description
createId ( Zend\Http\PhpEnvironment\Request $request ) : string Determine the page to save from the request
shouldCache ( MvcEvent $event ) : boolean Define if the page should be cached
shouldCacheRequest ( MvcEvent $e ) : boolean Determine if we should cache the current request

Method Details

__construct() public method

Constructor
public __construct ( Zend\Cache\Storage\StorageInterface $cacheStorage )
$cacheStorage Zend\Cache\Storage\StorageInterface Cache storage

createId() protected method

Determine the page to save from the request
protected createId ( Zend\Http\PhpEnvironment\Request $request ) : string
$request Zend\Http\PhpEnvironment\Request Http Request
return string

getEventManager() public method

Lazy-loads an EventManager instance if none registered.
public getEventManager ( ) : Zend\EventManager\EventManagerInterface
return Zend\EventManager\EventManagerInterface

load() public method

Return null when no item is found.
public load ( MvcEvent $e ) : mixed
$e Zend\Mvc\MvcEvent Mvc Event
return mixed

save() public method

Save the page contents to the cache storage.
public save ( MvcEvent $e ) : void
$e Zend\Mvc\MvcEvent Mvc Event
return void

setEventManager() public method

Inject an EventManager instance
public setEventManager ( Zend\EventManager\EventManagerInterface $eventManager ) : self
$eventManager Zend\EventManager\EventManagerInterface Event Manager
return self

shouldCache() protected method

Define if the page should be cached
protected shouldCache ( MvcEvent $event ) : boolean
$event Zend\Mvc\MvcEvent Event
return boolean

shouldCacheRequest() protected method

Determine if we should cache the current request
protected shouldCacheRequest ( MvcEvent $e ) : boolean
$e Zend\Mvc\MvcEvent Mvc Event
return boolean

Property Details

$eventManager protected property

Static event manager
protected EventManagerInterface,Zend\EventManager $eventManager
return Zend\EventManager\EventManagerInterface