PHPackages                             bnomei/kirby3-sqlite-cachedriver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. bnomei/kirby3-sqlite-cachedriver

ActiveKirby-plugin[Database &amp; ORM](/categories/database)

bnomei/kirby3-sqlite-cachedriver
================================

SQLite based Cache-Driver

1.4.2(4y ago)21.2kMITPHPPHP &gt;=7.4.0

Since Sep 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/bnomei/kirby3-sqlite-cachedriver)[ Packagist](https://packagist.org/packages/bnomei/kirby3-sqlite-cachedriver)[ Fund](https://buymeacoff.ee/bnomei)[ Fund](https://paypal.me/bnomei)[ RSS](/packages/bnomei-kirby3-sqlite-cachedriver/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (27)Used By (0)

🪶 Kirby SQLite Cache-Driver
===========================

[](#--kirby-sqlite-cache-driver)

[![Release](https://camo.githubusercontent.com/212e3ae56e8c96bfb554061c68707f0092a3ab9d50070234629e94b82d11fdd0/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d73716c6974652d63616368656472697665723f636f6c6f723d6165383166662669636f6e3d676974687562266c6162656c)](https://camo.githubusercontent.com/212e3ae56e8c96bfb554061c68707f0092a3ab9d50070234629e94b82d11fdd0/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d73716c6974652d63616368656472697665723f636f6c6f723d6165383166662669636f6e3d676974687562266c6162656c)[![Discord](https://camo.githubusercontent.com/36eaef1b06f4996feb7587aa3281dcbd658e57535bc6b5e10110ed108e7a7a03/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f646973636f72642f626e6f6d65693f636f6c6f723d3732383964612669636f6e3d646973636f7264266c6162656c)](https://discordapp.com/users/bnomei)[![Buymecoffee](https://camo.githubusercontent.com/62e55d1129b82bf9c2fd4656451e81ab87a9787e7c9676ca58276532ed9666ee/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f69636f6e2f646f6e6174653f69636f6e3d6275796d6561636f6666656526636f6c6f723d464638313346266c6162656c)](https://www.buymeacoffee.com/bnomei)

Feather - a highly performant SQLite Cache Driver for Kirby

Installation
------------

[](#installation)

- unzip [master.zip](https://github.com/bnomei/kirby3-sqlite-cachedriver/archive/master.zip) as folder `site/plugins/kirby3-sqlite-cachedriver` or
- `git submodule add https://github.com/bnomei/kirby3-sqlite-cachedriver.git site/plugins/kirby3-sqlite-cachedriver` or
- `composer require bnomei/kirby3-sqlite-cachedriver`

Why
---

[](#why)

### Memcached &lt; File &lt; Redis &lt; SQLite &lt; APCu

[](#memcached--file--redis--sqlite--apcu)

Kirby ships with built-in support for File, Memcached, and APCu Cache Drivers. I created a [Redis Cache Driver](https://github.com/bnomei/kirby3-redis-cachedriver), which is best suited for larger caches. If your hosting does not support Memcached, APCu, or Redis, then your next best choice is this SQLite Cache Driver.

### 2 is enough and about 35% faster

[](#2-is-enough-and-about-35-faster)

Let's imagine this typical scenario: During a single pageview, you need to access 100 cached values. Some of them already exist, some don't, some need to be refreshed, and yet others need to be deleted. A File Cache would cause at least 100 filesystem operations in total. Using this SQLite Cache you will have only one file read and one file write per pageview no matter how many values you get, update or remove. ✌️ However, reading and writing data to SQLite is not instantaneous so that it will be [at least 35% faster](https://www.hwaci.com/sw/sqlite/fasterthanfs.html).

Usage
-----

[](#usage)

### Cache methods

[](#cache-methods)

```
$cache = \Bnomei\SQLiteCache::singleton(); // or
$cache = feather();

$cache->set('key', 'value', $expireInMinutes);
$value = feather()->get('key', $default);

feather()->remove('key');
feather()->flush();
```

### Benchmark

[](#benchmark)

```
feather()->benchmark(1000);
```

```
sqlite : 0.075334072113037
file : 0.11837792396545
```

> ATTENTION: This will create and remove a lot of cache files and sqlite entries

### No cache when debugging

[](#no-cache-when-debugging)

When Kirby's global debug config is set to `true`, the complete plugin cache will be flushed, and no caches will be read. But entries will be created. This will make you live easier – trust me.

### How to use Feather with Lapse or Boost

[](#how-to-use-feather-with-lapse-or-boost)

You must set the cache driver for the [lapse plugin](https://github.com/bnomei/kirby3-lapse) to `sqlite`.

**site/config/config.php**

```
