Skip to content

Commit 51fefd7

Browse files
committed
readme.md: updated info
1 parent df86851 commit 51fefd7

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

readme.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,32 @@ 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+
1014
Cache accelerates your application by storing data - once hardly retrieved - for future use.
1115

12-
Install it using Composer:
16+
Documentation can be found on the [website](https://doc.nette.org/caching).
17+
18+
19+
Installation
20+
------------
21+
22+
The recommended way to install Nette Caching is via Composer:
1323

1424
```
1525
composer require nette/caching
1626
```
1727

18-
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.
28+
It requires PHP version 5.6 and supports PHP up to 7.2. The dev-master version requires PHP 7.1.
1929

20-
Nette offers a very intuitive API for cache manipulation. After all, you wouldn't expect anything else, right? ;-)
21-
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,
22-
or the most available storage - hard drive:
30+
31+
Usage
32+
-----
33+
34+
Nette Caching offers a very intuitive API for cache manipulation. Before we show you the first example, we need to think about place where
35+
to store data physically. We can use a database, Memcached server, or the most available storage - hard drive:
2336

2437
```php
2538
// the `temp` directory will be the storage
@@ -82,7 +95,7 @@ $cache = new Cache($storage, 'htmlOutput');
8295

8396

8497
Caching Function Results
85-
-------------------------
98+
------------------------
8699

87100
Caching the result of a function or method call can be achieved using the `call()` method:
88101

@@ -94,7 +107,7 @@ The `gethostbyaddr($ip)` will therefore be called only once and next time, only
94107
different results are cached.
95108

96109
Output Caching
97-
------------------
110+
--------------
98111

99112
The output can be cached not only in templates:
100113

@@ -217,9 +230,8 @@ $cache->clean(array(
217230
```
218231

219232

220-
221233
Cache Storage
222-
--------
234+
-------------
223235
In addition to already mentioned `FileStorage`, Nette Framework also provides `MemcachedStorage` which stores
224236
data to the `Memcached` server, and also `MemoryStorage` for storing data in memory for duration of the request.
225237
The special `DevNullStorage`, which does precisely nothing, can be used for testing, when we want to eliminate the influence of caching.
@@ -238,8 +250,8 @@ The solution is to modify application behaviour so that data are created only by
238250
or use an anonymous function:
239251

240252
```php
241-
$result = $cache->save($key, function() { // or callback(...)
242-
return buildData(); // difficult operation
253+
$result = $cache->save($key, function() {
254+
return buildData(); // difficult operation
243255
});
244256
```
245257

0 commit comments

Comments
 (0)