mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Add upgrade docs
This commit is contained in:
parent
4497f99d89
commit
8c56506a05
@ -171,3 +171,33 @@ $gridField = new GridField('Teams', 'Teams', $this->Teams(), $config);
|
||||
// method 2: removing GridField_ActionMenu from an existing GridField
|
||||
$gridField->getConfig()->removeComponentsByType(GridField_ActionMenu);
|
||||
```
|
||||
### Versioned cache segmentation
|
||||
|
||||
The cache API now maintains separate cache pools for each versioned stage. This prevents users from caching draft data and then exposing it on the live stage.
|
||||
|
||||
```php
|
||||
// Before:
|
||||
$cache = Injector::inst()->get(CacheInterface::class . '.myapp');
|
||||
Versioned::set_stage(Versioned::DRAFT);
|
||||
$cache->set('my_key', 'Some draft content. Not for public viewing yet.');
|
||||
Versioned::set_stage(Versioned::LIVE);
|
||||
$cache->get('my_key'); // 'Some draft content. Not for public viewing yet'
|
||||
|
||||
// After:
|
||||
$cache = Injector::inst()->get(CacheInterface::class . '.myapp');
|
||||
Versioned::set_stage(Versioned::DRAFT);
|
||||
$cache->set('my_key', 'Some draft content. Not for public viewing yet.');
|
||||
Versioned::set_stage(Versioned::LIVE);
|
||||
$cache->get('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.
|
||||
|
||||
```yaml
|
||||
SilverStripe\Core\Injector\Injector:
|
||||
Psr\SimpleCache\CacheInterface.myapp:
|
||||
factory: SilverStripe\Core\Cache\CacheFactory
|
||||
constructor:
|
||||
namespace: "MyInsensitiveData"
|
||||
args:
|
||||
disable-container: true
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user