WebOfTalent\Cache\CacheKeyHelperExtension
Synopsis
class CacheKeyHelperExtension
extends DataExtension
{
- // members
- private RequestProvider $requestProvider;
- private static array $indexes = ;
- private static array<string $last_edited_values = ;
- private static bool $cachekeysinitialised = false;
- // methods
- public string CacheKeyParamVar()
- public void CacheKeyGetVar()
- public void PeriodKey()
- public string CacheKeyLastEdited()
- public static void resetCache()
- private void prime_cache_keys()
- private string getTableName()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Tasks
Line | Task |
---|---|
225 | is this necessary as POST vars would override |
Members
private
- $cachekeysinitialised — WebOfTalent\Cache\bool
- $indexes
- $last_edited_values — WebOfTalent\Cache\array<string
- $requestProvider — \WebOfTalent\Cache\RequestProvider
Methods
private
public
- CacheKeyGetVar() — Append a url parameter to the cache key. This is useful for example when using pagination
- CacheKeyLastEdited() — Obtain a cache for a given class with a given prefix, to be used in templates for partial caching. It is designed to ensure that the query for caching is only called once and that all caching values are calculated at this time. They are subsequently stored in a local static variable for use in other parts of the page being rendered.
- CacheKeyParamVar() — Obtain a part of the cache key fragment based on a parameter name obtained from routing only In a template this would look like <tt>$CacheParamKey('start')</tt>
- PeriodKey() — Provide for a portion of a key that is cached for a certain amount of time. This is useful for calling external APIs, where you do not want to hit them every request (for example, getting the current weather could be delayed to every 15 mins)
- resetCache() — This is used in testing only to simulate a new request in between tests