mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Update documentation
This commit is contained in:
parent
85a712e1c9
commit
f4411df75c
@ -90,6 +90,20 @@ e.g. by including the `LastEdited` value when caching `DataObject` results.
|
||||
// set all caches to 3 hours
|
||||
SS_Cache::set_cache_lifetime('any', 60*60*3);
|
||||
|
||||
### Versioned cache segmentation
|
||||
|
||||
`SS_Cache` segments caches based on the versioned reading mode. This prevents developers
|
||||
from caching draft data and then accidentally exposing it on the live stage without potentially
|
||||
required authorisation checks. This segmentation is automatic for all caches generated using
|
||||
`SS_Cache::factory` method.
|
||||
|
||||
Data that is not content sensitive can be cached across stages by simply opting out of the
|
||||
segmented cache with the `disable-segmentation` argument.
|
||||
|
||||
```php
|
||||
$cache = SS_Cache::factory('myapp', 'Output', array('disable-segmentation' => true));
|
||||
```
|
||||
|
||||
## Alternative Cache Backends
|
||||
|
||||
By default, SilverStripe uses a file-based caching backend.
|
||||
|
@ -19,8 +19,8 @@ $cache->save('Some draft content. Not for public viewing yet.', 'my_key');
|
||||
Versioned::set_reading_mode('Stage.Live');
|
||||
$cache->load('my_key'); // null
|
||||
```
|
||||
Data that is not content sensitive can be cached across stages by simply opting out of the segmented cache with the `disable-container` argument.
|
||||
Data that is not content sensitive can be cached across stages by simply opting out of the segmented cache with the `disable-segmentation` argument.
|
||||
|
||||
```php
|
||||
$cache = SS_Cache::factory('myapp', 'Output', array('disable-container' => true));
|
||||
```
|
||||
$cache = SS_Cache::factory('myapp', 'Output', array('disable-segmentation' => true));
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user