@@ -7,21 +7,33 @@ Nette Caching
77[ ![ Latest Stable Version] ( https://poser.pugx.org/nette/caching/v/stable )] ( https://github.com/nette/caching/releases )
88[ ![ License] ( https://img.shields.io/badge/license-New%20BSD-blue.svg )] ( https://github.com/nette/caching/blob/master/license.md )
99
10+
11+ Introduction
12+ ------------
13+
1014Cache accelerates your application by storing data - once hardly retrieved - for future use.
1115
16+ Documentation can be found on the [ website] ( https://doc.nette.org/caching ) .
1217If you like Nette, ** [ please make a donation now] ( https://nette.org/donate ) ** . Thank you!
1318
14- Install it using Composer:
19+
20+ Installation
21+ ------------
22+
23+ The recommended way to install Nette Caching is via Composer:
1524
1625```
1726composer require nette/caching
1827```
1928
20- The last stable release requires PHP version 5.6 or newer (is compatible with PHP 7.0 and 7.1) . The dev-master version requires PHP 7.1.
29+ It requires PHP version 5.6 and supports PHP up to 7.3 . The dev-master version requires PHP 7.1.
2130
22- Nette offers a very intuitive API for cache manipulation. After all, you wouldn't expect anything else, right? ;-)
23- Before we show you the first example, we need to think about place where to store data physically. We can use a database, //Memcached// server,
24- or the most available storage - hard drive:
31+
32+ Usage
33+ -----
34+
35+ Nette Caching offers a very intuitive API for cache manipulation. Before we show you the first example, we need to think about place where
36+ to store data physically. We can use a database, Memcached server, or the most available storage - hard drive:
2537
2638``` php
2739// the `temp` directory will be the storage
@@ -84,7 +96,7 @@ $cache = new Cache($storage, 'htmlOutput');
8496
8597
8698Caching Function Results
87- -------------------------
99+ ------------------------
88100
89101Caching the result of a function or method call can be achieved using the ` call() ` method:
90102
@@ -96,7 +108,7 @@ The `gethostbyaddr($ip)` will therefore be called only once and next time, only
96108different results are cached.
97109
98110Output Caching
99- ------------------
111+ --------------
100112
101113The output can be cached not only in templates:
102114
@@ -219,9 +231,8 @@ $cache->clean(array(
219231```
220232
221233
222-
223234Cache Storage
224- --------
235+ -------------
225236In addition to already mentioned ` FileStorage ` , Nette Framework also provides ` MemcachedStorage ` which stores
226237data to the ` Memcached ` server, and also ` MemoryStorage ` for storing data in memory for duration of the request.
227238The special ` DevNullStorage ` , which does precisely nothing, can be used for testing, when we want to eliminate the influence of caching.
@@ -240,8 +251,8 @@ The solution is to modify application behaviour so that data are created only by
240251or use an anonymous function:
241252
242253``` php
243- $result = $cache->save($key, function() { // or callback(...)
244- return buildData(); // difficult operation
254+ $result = $cache->save($key, function() {
255+ return buildData(); // difficult operation
245256});
246257```
247258
0 commit comments