Contributte Cache
# Content
# Setup
composer require contributte/cache
1
# Cache Factory
Don't waste time by passing Nette\Caching\IStorage
directly to your classes. Use our tuned CacheFactory
.
extensions:
cache.factory: Contributte\Cache\DI\CacheFactoryExtension
1
2
2
By default Nette\Caching\Cache
is provided when $cacheFactory->create()
is called. You can change it to your implementation.
services:
cache.factory.factory: App\Model\MyCacheFactory
1
2
2
# Storages
MemoryAdapterStorage
- Optimized for reading of same key multiple times during one application run
use Contributte\Cache\Storages\MemoryAdapterStorage;
use Nette\Caching\Storages\FileStorage;
use Nette\Caching\Storages\SQLiteJournal;
$storage = new MemoryAdapterStorage(
new FileStorage($path, new SQLiteJournal($path))
);
1
2
3
4
5
6
7
2
3
4
5
6
7
# Debug panel
Show all calls to storage in Tracy panel
extensions:
cache.debug: Contributte\Cache\DI\DebugStorageExtension
cache.debug:
debug: %debugMode%
1
2
3
4
5
2
3
4
5