toastnz / dbcache
DataObject-based cache for SilverStripe
Installs: 614
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- silverstripe/framework: ~4.0
- silverstripe/vendor-plugin: ^1.0
README
DataObject-based cache for SilverStripe.
Requirements
- SilverStripe 4
Installation
composer require toastnz/dbcache
Set the default expiry time in minutes for cache entries
Toast\DBCache\Helpers\DBCache: expiry_minutes: 0
Whether to clear all cached data when ?flush is invoked
Toast\DBCache\Extensions\ControllerDBCacheExtension: clear_on_flush: true
Manipulate cache entries
// Cache "filters" for 10 minutes under the namespace "product" DBCache::set('product.filters', json_encode($products), 10); // Retrieve from cache DBCache::get('product.filters'); // Remove from cache DBCache::clear('product.filters'); // Flush cached data for the "product" namespace DBCache::flush('product'); // Flush all cached data DBCache::flush();