\FrontendProxy
- Author: <marcus@silverstripe.com.au>
- License: BSD License http://www.silverstripe.org/bsd-license
Synopsis
class FrontendProxy
{
- // members
- protected $server;
- protected $env;
- protected array $bypassCookies = ;
- protected SimpleCache $staticCache;
- protected SimpleCache $dynamicCache;
- protected boolean $cacheGetVars = false;
- protected type $ignoreGetVars = false;
- protected $urlRules;
- protected SimpleCacheItem $currentItem;
- protected array $headers = ;
- protected boolean $enabled = true;
- protected $remapHosts;
- protected $contentRewriter;
- protected array $blacklist = ;
- protected array $storeHeaders = ;
- protected boolean $includeCacheHeaders = true;
- // methods
- public void __construct()
- public void setIncludeCacheHeaders()
- public void checkIfEnabled()
- public void urlIsCached()
- public void canCache()
- public void expiryForUrl()
- public void configForUrl()
- public string urlForCaching()
- public void generateCache()
- protected void ageFromHeaders()
- protected void headersToStore()
- public boolean serve()
- public void getCachedValue()
- public void setCacheGetVars()
- public void setIgnoreGetVars()
- public void setBlacklist()
- public void setRemapHosts()
- public void setContentRewriter()
- protected string remappedHost()
- protected void isHttps()
Members
protected
- $blacklist
—
boolean
Regex matches for whether certain hostnames are enabled or not for caching - $bypassCookies
—
array
A list of cookies to bypass caching if present - $cacheGetVars
—
boolean
Do we cache URLs with GET params? - $contentRewriter
—
string
A Class name for a class to use for rewriting content for cache responses - $currentItem
—
SimpleCacheItem
The most recent item retrieved or added to the cache - $dynamicCache — SimpleCache
- $enabled
—
boolean
Are we enabled? Typically disabled by the cookie check - $env
—
array
ENV vars to take into account - $headers
—
array
A List of headers to output when dumping the currentItem - $ignoreGetVars
—
type
From a cache perspective, should GET parameters be ignored? - $includeCacheHeaders
—
boolean
Should X-SilverStripe-Cache headers be output? - $remapHosts
—
array
A list of hostnames that should retrieve cached data from a _different_ host - $server
—
array
SERVER vars to disable/enable based upon - $staticCache — SimpleCache
- $storeHeaders
—
array
A list of headers to _not_ proxy in dynamic cached requests - $urlRules
—
array
A list of url => expiry mapping that indicate how long particular url sets can be cached on-request. Specify -1 to NEVER cache a particular URL, entered in the list prior to the larger rule that would match it
Methods
protected
- ageFromHeaders() — Try and find the max-age from the list of headers
- headersToStore() — Return an array of headers to save based on a set of headers returned by SS
- isHttps()
- remappedHost() — If found, return the host name that should be used for caching a particular piece of content
public
- __construct()
- canCache()
- checkIfEnabled()
- configForUrl()
- expiryForUrl()
- generateCache()
- getCachedValue()
- serve() — Serve the content item wrapped by the proxy.
- setBlacklist()
- setCacheGetVars()
- setContentRewriter()
- setIgnoreGetVars()
- setIncludeCacheHeaders()
- setRemapHosts()
- urlForCaching() — Return a URL slightly dressed up to use for cache interrogation
- urlIsCached()