You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 18, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+68-33Lines changed: 68 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ If you have a lot of page objects (1000+) with or without relations to each othe
16
16
## How does this plugin work?
17
17
18
18
- It caches all content files and keeps the cache up to date when you add or modify content. This cache will be used when constructing page objects making everything that involves page objects faster (even the Panel).
19
+
- It provides a benchmark to help you decide which cachedriver to use.
19
20
- It can add an unique ID for page objects that can be used create relations that do not break even if the slug or directory of a page object changes.
20
21
- It provides a very fast lookup for page objects via id, diruri or the unique id.
21
22
- It provides you with a tiny-url for page objects that have an unique id.
@@ -82,53 +83,87 @@ $page = boost($boostId); // will use fastest internally
82
83
$page = modified($somePageId);
83
84
```
84
85
85
-
## Memcached
86
+
## Cache
86
87
87
-
This plugin uses the PHP Memcached extension for optimal performance. Not Memcache, but Memcached. It can also use Kirbys default file cache driver.
88
+
### Limitations
88
89
89
-
### Memcached Setup
90
+
How much and if you gain anything regarding performance depends on the hardware. All your content files must fit within the memory limitation. If you run into errors consider increasing the server settings or choose a different cache driver.
Kirby has [built in support](https://getkirby.com/docs/reference/system/options/cache#cache-driver) for File, Apcu, Memcached and Memory. I have created additional cache drivers for [SQLite](https://github.com/bnomei/kirby3-sqlite-cachedriver) and [Redis](https://github.com/bnomei/kirby3-redis-cachedriver).
109
98
110
99
### Benchmark
111
100
112
-
The included benchmark can help you make an educated guess if on your server the memcached cache driver is faster than the file cache driver. This will create and remove 2000 items cached.
101
+
The included benchmark can help you make an educated guess which is the faster cache driver. The only way to make sure is measuring in production.
102
+
Be aware that this will create and remove 2000 items cached. The benchmark will try to perform as many get operations within given timeframe (default 2 seconds per cache). The higher results are better.
Memory Cache Driver will probably perform best but caches in memory only for current request and that is not really usefull for this plugin. SQLite Cache Driver will perform very well since everything will be in one file and I optimized the read/write with [pragmas](https://github.com/bnomei/kirby3-sqlite-cachedriver/blob/bc3ccf56cefff7fd6b0908573ce2b4f09365c353/index.php#L20) and [wal journal mode](https://github.com/bnomei/kirby3-sqlite-cachedriver/blob/bc3ccf56cefff7fd6b0908573ce2b4f09365c353/index.php#L34).
120
+
121
+
But do not take my word for it. Run the benchmark on your production server.
122
+
123
+
### Config
124
+
125
+
Once you know which driver you want to use you can set the plugin cache options.
123
126
124
-
How much and if you gain anything regarding performance depends on the hardware. But on most production servers reading data from RAM (via TCP/IP) should be faster than reading a lot of files (even from SSD disks).
127
+
**site/config/config.php**
128
+
```php
129
+
<?php
130
+
131
+
return [
132
+
// other options
133
+
134
+
// default is file cache driver
135
+
'bnomei.boost.cache' => [
136
+
'type' => 'file',
137
+
'prefix' => 'boost',
138
+
],
139
+
140
+
// example memached
141
+
'bnomei.boost.cache' => [
142
+
'type' => 'memcached',
143
+
'prefix' => 'boost',
144
+
'host' => '127.0.0.1',
145
+
'port' => 11211,
146
+
],
125
147
126
-
All your content files must fit within the memory limitation of Memcached Server. If you run into errors consider increasing the server settings.
0 commit comments