StaticViewService
extends BaseService
in package
The StaticViewService is responsible for managing the storage and invalidation of static views. It is the core of CEO's dynamically-static (statically-dynamic?) caching system.
In order for the system to know what is cached with what view there are two components to watch for:
-
StaticViewService::cacheViewForRoute
-
StaticViewService::linkRouteToContent
The first links a full view output to a route. The second links a route to a UUID. Knowing both, the system can properly invalidate cached views whenever content is updated.
Table of Contents
- cacheViewForRoute() : bool
- Cache full view for route
- getViewForRoute() : string
- Fetch view for given route. Will return false if route does not exist or cache has timed out.
- invalidateRoute() : bool
- Invalidate a route regardless of timeout. Invaliding a route will force it to regenerate at the next request.
- invalidateUuid() : bool
- Invalidate a uuid regardless of view timeout. Invaliding a UUID will invalidate ALL routes the UUID is associated with.
- linkRouteToContent() : bool
- Link a route to a UUID.
Methods
cacheViewForRoute()
Cache full view for route
public
cacheViewForRoute(string $view[, string $route = false ]) : bool
Parameters
- $view : string
- $route : string = false
Return values
bool —getViewForRoute()
Fetch view for given route. Will return false if route does not exist or cache has timed out.
public
getViewForRoute(string $route) : string
Parameters
- $route : string
Return values
string —or boolean
invalidateRoute()
Invalidate a route regardless of timeout. Invaliding a route will force it to regenerate at the next request.
public
invalidateRoute(string $route[, mixed $isHashed = false ]) : bool
Parameters
- $route : string
- $isHashed : mixed = false
Return values
bool —invalidateUuid()
Invalidate a uuid regardless of view timeout. Invaliding a UUID will invalidate ALL routes the UUID is associated with.
public
invalidateUuid(string $uuid) : bool
Parameters
- $uuid : string
Return values
bool —linkRouteToContent()
Link a route to a UUID.
public
linkRouteToContent(string $uuid[, string $route = false ]) : bool
Keep in mind these are written as a transaction at the end of the request to limit overwrites.
Parameters
- $uuid : string
- $route : string = false