Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vladahejda/nettedatabasestorage

NetteDatabase Storage
https://github.com/vladahejda/nettedatabasestorage

Last synced: about 1 month ago
JSON representation

NetteDatabase Storage

Awesome Lists containing this project

README

        

NetteDatabase Storage
=====================

Install
-------

### #1

Download [`src/NetteDatabaseStorage.php`](src/NetteDatabaseStorage.php).

### #2

Create cache table in your database (see [`mysql.cache.sql`](assets/mysql.cache.sql) or
[`postgres.cache.sql`](assets/postgres.cache.sql), you can adapt script for another database server (not tested);
you can change table name).

### #3

Instantiate `Nette\Caching\Cache`:

```php
$context = new \Nette\Database\Context(...);
$storage = new \Nette\Caching\Storages\DatabaseStorage($context, 'cache_table_name');
$cache = new \Nette\Caching\Cache($storage);
```

### #4

Use it.